Skip to content

Commit

Permalink
🐛 fix(build): fix nextjs build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thrownullexception committed Jan 3, 2024
1 parent 9b98310 commit f6f6021
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/frontend/hooks/setup/setup.store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CRUD_CONFIG_NOT_FOUND } from "frontend/lib/crud-config";
import { useStorageApi } from "frontend/lib/data/useApi";
import { useRouter } from "next/router";
import { useEffect } from "react";
import { ISetupCheck } from "shared/types/auth";

export const SETUP_CHECK_URL = "/api/setup/check";
Expand All @@ -21,15 +22,17 @@ export function useSetupCheck(config: ISetupCheckConfig[]) {
},
});

useEffect(() => {
config.forEach((configItem) => {
if (data[configItem.key] === configItem.value) {
router.replace(configItem.url);
}
});
}, [data]);

if (isLoading || !data) {
return isLoading;
}

config.forEach((configItem) => {
if (data[configItem.key] === configItem.value) {
router.replace(configItem.url);
}
});

return false;
}

0 comments on commit f6f6021

Please sign in to comment.