🐛fix: public shared view sso redirect (#389)

Co-authored-by: Monta <monta@HP-ProBook-445-14-inch-G9-Notebook-PC-505aadfc.localdomain>
This commit is contained in:
Montassar Ghanmy
2024-02-28 09:40:54 +01:00
committed by GitHub
parent b82b78aa7d
commit 4f372adddc
2 changed files with 6 additions and 2 deletions
@@ -34,6 +34,7 @@ export type ClientStateType = {
threadId?: string; threadId?: string;
tabId?: string; tabId?: string;
directoryId?: string; directoryId?: string;
appName?: string;
}; };
export type Pathnames = { export type Pathnames = {
@@ -3,6 +3,7 @@ import { UserQuota } from '@features/users/types/user-quota';
import UserAPIClient from '@features/users/api/user-api-client'; import UserAPIClient from '@features/users/api/user-api-client';
import { useCurrentUser } from "features/users/hooks/use-current-user"; import { useCurrentUser } from "features/users/hooks/use-current-user";
import { atom, useRecoilState } from "recoil"; import { atom, useRecoilState } from "recoil";
import useRouteState from "app/features/router/hooks/use-route-state";
export const QuotaState = atom<UserQuota>({ export const QuotaState = atom<UserQuota>({
key: 'QuotaState', key: 'QuotaState',
@@ -19,12 +20,14 @@ export const useUserQuota = () => {
remaining: 1, remaining: 1,
total: 1 total: 1
} }
const {user } = useCurrentUser(); const { appName } = useRouteState();
const isPublic = appName === 'drive';
const { user } = isPublic ? { user: null } : useCurrentUser();
const [quota, setQuota] = useRecoilState(QuotaState); const [quota, setQuota] = useRecoilState(QuotaState);
const getQuota = useCallback(async () => { const getQuota = useCallback(async () => {
let data: UserQuota = nullQuota; let data: UserQuota = nullQuota;
if (user?.id) { if (user && user?.id) {
data = await UserAPIClient.getQuota(user.id); data = await UserAPIClient.getQuota(user.id);
} else { } else {
data = nullQuota; data = nullQuota;