Browse Source

fix: token refresh failed handle it

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/9827/head
Pranav C 1 week ago
parent
commit
6d56193307
  1. 8
      packages/nc-gui/composables/useApi/interceptors.ts
  2. 6
      packages/nc-gui/composables/useGlobal/types.ts
  3. 4
      packages/nocodb-sdk/src/lib/Api.ts

8
packages/nc-gui/composables/useApi/interceptors.ts

@ -67,6 +67,14 @@ export function addAxiosInterceptors(api: Api<any>) {
skipLogout: true,
})
if (!token) {
await state.signOut({
redirectToSignin: !isSharedPage,
skipApiCall: true,
})
return Promise.reject(error)
}
const config = error.config
config.headers['xc-auth'] = token

6
packages/nc-gui/composables/useGlobal/types.ts

@ -92,7 +92,11 @@ export interface SignOutParams {
export interface Actions {
signOut: (signOutParams?: SignOutParams) => Promise<void>
signIn: (token: string, keepProps?: boolean) => void
refreshToken: (params: { axiosInstance?: AxiosInstance; skipLogout?: boolean; cognitoOnly?: boolean }) => Promise<void>
refreshToken: (params: {
axiosInstance?: AxiosInstance
skipLogout?: boolean
cognitoOnly?: boolean
}) => Promise<string | null | void>
loadAppInfo: () => void
setIsMobileMode: (isMobileMode: boolean) => void
navigateToProject: (params: { workspaceId?: string; baseId?: string; type?: NcProjectType; query?: any }) => void

4
packages/nocodb-sdk/src/lib/Api.ts

@ -2846,6 +2846,8 @@ export interface ViewType {
| MapType
| CalendarType
| (FormType & GalleryType & GridType & KanbanType & MapType & CalendarType);
/** ID of view owner user */
owned_by?: IdType;
}
/**
@ -2918,6 +2920,8 @@ export interface ViewUpdateReqType {
order?: number;
/** Should this view show system fields? */
show_system_fields?: BoolType;
/** ID of view owner user */
owned_by?: IdType;
}
/**

Loading…
Cancel
Save