🐛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;
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user