mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
fix: change the me endpoint to useQuery api
This commit is contained in:
@@ -4,6 +4,6 @@ import { baseQueryWithReauth } from './base-query-with-reauth';
|
||||
export const baseApi = createApi({
|
||||
reducerPath: 'baseApi',
|
||||
baseQuery: baseQueryWithReauth,
|
||||
tagTypes: ['Api'],
|
||||
tagTypes: ['Api', 'Me'],
|
||||
endpoints: () => ({}),
|
||||
});
|
||||
|
||||
@@ -22,11 +22,15 @@ const queryApi = baseApi.injectEndpoints({
|
||||
headers,
|
||||
}),
|
||||
}),
|
||||
getMe: builder.query<unknown, void>({
|
||||
query: () => '/auth/me',
|
||||
providesTags: ['Me'],
|
||||
}),
|
||||
}),
|
||||
overrideExisting: false,
|
||||
});
|
||||
|
||||
export const { useApiQueryQuery, useApiMutationMutation } = queryApi;
|
||||
export const { useApiQueryQuery, useApiMutationMutation, useGetMeQuery } = queryApi;
|
||||
|
||||
export function useApiQuery<TData = unknown>(
|
||||
args: ApiQueryArgs,
|
||||
|
||||
@@ -5,11 +5,7 @@ export const SESSION_HEADER_KEYS = {
|
||||
currentProjectId: 'x-current-project-id',
|
||||
} as const;
|
||||
|
||||
const TOKEN_STORAGE_KEYS = [
|
||||
'ema-backoffice-auth-token',
|
||||
'ema-portal-auth-token',
|
||||
'auth-token',
|
||||
] as const;
|
||||
const TOKEN_STORAGE_KEYS = ['auth-token'] as const;
|
||||
|
||||
export function resolveTokenFromStorage(): string | undefined {
|
||||
for (const key of TOKEN_STORAGE_KEYS) {
|
||||
|
||||
Reference in New Issue
Block a user