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:
parent
b0397dfd74
commit
a9b72fa1d2
9 changed files with 164 additions and 190 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue