diff --git a/dashboard/components/cloud-account/hooks/useCloudAccounts/useCloudAccount.ts b/dashboard/components/cloud-account/hooks/useCloudAccounts/useCloudAccount.ts index defa9b6b4..e3b939ad2 100644 --- a/dashboard/components/cloud-account/hooks/useCloudAccounts/useCloudAccount.ts +++ b/dashboard/components/cloud-account/hooks/useCloudAccounts/useCloudAccount.ts @@ -31,6 +31,12 @@ function useCloudAccount() { const [error, setError] = useState(false); useEffect(() => { + settingsService.getOnboardingStatus().then(res => { + if (res === Error || res.onboarded === false) { + router.push('/onboarding/choose-cloud'); + } + }); + settingsService.getCloudAccounts().then(res => { if (!loading) { setLoading(true); diff --git a/dashboard/services/settingsService.ts b/dashboard/services/settingsService.ts index 8ebd2d28d..bde278fb1 100644 --- a/dashboard/services/settingsService.ts +++ b/dashboard/services/settingsService.ts @@ -408,6 +408,16 @@ const settingsService = { } catch (error) { return Error; } + }, + + async getOnboardingStatus() { + try { + const res = await fetch(`${BASE_URL}/is_onboarded`, settings('GET')); + const data = await res.json(); + return data; + } catch (error) { + return Error; + } } };