🐛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:
@@ -34,6 +34,7 @@ export type ClientStateType = {
|
||||
threadId?: string;
|
||||
tabId?: string;
|
||||
directoryId?: string;
|
||||
appName?: string;
|
||||
};
|
||||
|
||||
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 { useCurrentUser } from "features/users/hooks/use-current-user";
|
||||
import { atom, useRecoilState } from "recoil";
|
||||
import useRouteState from "app/features/router/hooks/use-route-state";
|
||||
|
||||
export const QuotaState = atom<UserQuota>({
|
||||
key: 'QuotaState',
|
||||
@@ -19,12 +20,14 @@ export const useUserQuota = () => {
|
||||
remaining: 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 getQuota = useCallback(async () => {
|
||||
let data: UserQuota = nullQuota;
|
||||
if (user?.id) {
|
||||
if (user && user?.id) {
|
||||
data = await UserAPIClient.getQuota(user.id);
|
||||
} else {
|
||||
data = nullQuota;
|
||||
|
||||
Reference in New Issue
Block a user