mirror of https://github.com/buster-so/buster.git
updated the embed axios handler
This commit is contained in:
parent
a8c6b1ad00
commit
04596cf547
|
@ -431,7 +431,6 @@ export const useUpdateChatShare = () => {
|
|||
}
|
||||
if (variables.params.workspace_sharing !== undefined) {
|
||||
draft.workspace_sharing = variables.params.workspace_sharing;
|
||||
s;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -50,9 +50,10 @@ export const defaultAxiosRequestHandler = async (config: InternalAxiosRequestCon
|
|||
const { accessToken: token } = session;
|
||||
|
||||
if (!token) {
|
||||
console.warn('No token found');
|
||||
window.location.href = AuthRoute.to;
|
||||
return Promise.reject(new Error('No token found'));
|
||||
console.warn('No token found', config);
|
||||
//embed route were having an issue with this...
|
||||
//window.location.href = AuthRoute.to;
|
||||
//return Promise.reject(new Error('No token found'));
|
||||
}
|
||||
|
||||
(config.headers as AxiosRequestHeaders).Authorization = `Bearer ${token}`;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import type { AssetType } from '@buster/server-shared/assets';
|
||||
import { createFileRoute, Outlet, type RouteContext } from '@tanstack/react-router';
|
||||
import { prefetchGetMyUserInfo } from '@/api/buster_rest/users';
|
||||
import { getSupabaseSession } from '@/integrations/supabase/getSupabaseUserClient';
|
||||
import { signInWithAnonymousUser } from '@/integrations/supabase/signIn';
|
||||
import { AppAssetCheckLayout } from '@/layouts/AppAssetCheckLayout';
|
||||
|
||||
export const Route = createFileRoute('/embed')({
|
||||
beforeLoad: async ({ context, matches }) => {
|
||||
const user = await prefetchGetMyUserInfo(context.queryClient);
|
||||
if (!user) await signInWithAnonymousUser(); //we fallback to an anonymous user
|
||||
const token = await getSupabaseSession();
|
||||
if (token.accessToken) await prefetchGetMyUserInfo(context.queryClient);
|
||||
else await signInWithAnonymousUser(); //we fallback to an anonymous user
|
||||
|
||||
const assetType = [...matches].reverse().find(({ staticData }) => staticData?.assetType)
|
||||
?.staticData?.assetType as AssetType;
|
||||
|
|
Loading…
Reference in New Issue