fix: workspace members store added and implemented across the app (#2732)

* fix: minor changes

* fix: workspace members store added and implemnted across the app
This commit is contained in:
sriram veeraghanta 2023-11-09 00:35:12 +05:30 committed by GitHub
parent 556b2d2617
commit a6567bbce4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 529 additions and 352 deletions

View file

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