chore: implemented MobX in the onboarding screens (#2617)

* fix: wrap the onboarding route with the UserWrapper

* chore: implement mobx in the onboarding screens
This commit is contained in:
Aaryan Khandelwal 2023-11-02 19:27:25 +05:30 committed by GitHub
parent b0397dfd74
commit a9b72fa1d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 164 additions and 190 deletions

View file

@ -13,13 +13,15 @@ export interface IUserAuthWrapper {
export const UserAuthWrapper: FC<IUserAuthWrapper> = (props) => {
const { children } = props;
// store
const { user: userStore } = useMobxStore();
const { user: userStore, workspace: workspaceStore } = useMobxStore();
// router
const router = useRouter();
// fetching user information
const { data: currentUser, error } = useSWR("CURRENT_USER_DETAILS", () => userStore.fetchCurrentUser());
// fetching user settings
useSWR("CURRENT_USER_SETTINGS", () => userStore.fetchCurrentUserSettings());
// fetching all workspaces
useSWR(`USER_WORKSPACES_LIST`, () => workspaceStore.fetchWorkspaces());
if (!currentUser && !error) {
return (