mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat: force setup if app is not initialized
This commit is contained in:
@@ -44,7 +44,7 @@ const Discover: React.FC = () => {
|
||||
);
|
||||
|
||||
const { data: media, error: mediaError } = useSWR<MediaResultsResponse>(
|
||||
'/api/v1/media?filter=available&take=20'
|
||||
'/api/v1/media?filter=available&take=20&sort=modified'
|
||||
);
|
||||
|
||||
const { data: requests, error: requestError } = useSWR<MediaRequest[]>(
|
||||
|
@@ -6,12 +6,33 @@ import SettingsPlex from '../Settings/SettingsPlex';
|
||||
import SettingsServices from '../Settings/SettingsServices';
|
||||
import LoginWithPlex from './LoginWithPlex';
|
||||
import SetupSteps from './SetupSteps';
|
||||
import axios from 'axios';
|
||||
import { defineMessages, FormattedMessage } from 'react-intl';
|
||||
|
||||
const messages = defineMessages({
|
||||
finish: 'Finish Setup',
|
||||
finishing: 'Finishing...',
|
||||
continue: 'Continue',
|
||||
});
|
||||
|
||||
const Setup: React.FC = () => {
|
||||
const [isUpdating, setIsUpdating] = useState(false);
|
||||
const [currentStep, setCurrentStep] = useState(1);
|
||||
const [plexSettingsComplete, setPlexSettingsComplete] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
const finishSetup = async () => {
|
||||
setIsUpdating(false);
|
||||
const response = await axios.get<{ initialized: boolean }>(
|
||||
'/api/v1/settings/initialize'
|
||||
);
|
||||
|
||||
setIsUpdating(false);
|
||||
if (response.data.initialized) {
|
||||
router.push('/');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-cool-gray-900 flex flex-col justify-center py-12 sm:px-6 lg:px-8 relative">
|
||||
<ImageFader
|
||||
@@ -68,7 +89,7 @@ const Setup: React.FC = () => {
|
||||
disabled={!plexSettingsComplete}
|
||||
onClick={() => setCurrentStep(3)}
|
||||
>
|
||||
Continue
|
||||
<FormattedMessage {...messages.continue} />
|
||||
</Button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -83,9 +104,14 @@ const Setup: React.FC = () => {
|
||||
<span className="ml-3 inline-flex rounded-md shadow-sm">
|
||||
<Button
|
||||
buttonType="primary"
|
||||
onClick={() => router.push('/')}
|
||||
onClick={() => finishSetup()}
|
||||
disabled={isUpdating}
|
||||
>
|
||||
Finish Setup
|
||||
{isUpdating ? (
|
||||
<FormattedMessage {...messages.finishing} />
|
||||
) : (
|
||||
<FormattedMessage {...messages.finish} />
|
||||
)}
|
||||
</Button>
|
||||
</span>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user