updated the embed axios handler

This commit is contained in:
Nate Kelley 2025-09-25 15:36:07 -06:00
parent a8c6b1ad00
commit 04596cf547
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 8 additions and 6 deletions

View File

@ -431,7 +431,6 @@ export const useUpdateChatShare = () => {
} }
if (variables.params.workspace_sharing !== undefined) { if (variables.params.workspace_sharing !== undefined) {
draft.workspace_sharing = variables.params.workspace_sharing; draft.workspace_sharing = variables.params.workspace_sharing;
s;
} }
}); });
}); });

View File

@ -50,9 +50,10 @@ export const defaultAxiosRequestHandler = async (config: InternalAxiosRequestCon
const { accessToken: token } = session; const { accessToken: token } = session;
if (!token) { if (!token) {
console.warn('No token found'); console.warn('No token found', config);
window.location.href = AuthRoute.to; //embed route were having an issue with this...
return Promise.reject(new Error('No token found')); //window.location.href = AuthRoute.to;
//return Promise.reject(new Error('No token found'));
} }
(config.headers as AxiosRequestHeaders).Authorization = `Bearer ${token}`; (config.headers as AxiosRequestHeaders).Authorization = `Bearer ${token}`;

View File

@ -1,13 +1,15 @@
import type { AssetType } from '@buster/server-shared/assets'; import type { AssetType } from '@buster/server-shared/assets';
import { createFileRoute, Outlet, type RouteContext } from '@tanstack/react-router'; import { createFileRoute, Outlet, type RouteContext } from '@tanstack/react-router';
import { prefetchGetMyUserInfo } from '@/api/buster_rest/users'; import { prefetchGetMyUserInfo } from '@/api/buster_rest/users';
import { getSupabaseSession } from '@/integrations/supabase/getSupabaseUserClient';
import { signInWithAnonymousUser } from '@/integrations/supabase/signIn'; import { signInWithAnonymousUser } from '@/integrations/supabase/signIn';
import { AppAssetCheckLayout } from '@/layouts/AppAssetCheckLayout'; import { AppAssetCheckLayout } from '@/layouts/AppAssetCheckLayout';
export const Route = createFileRoute('/embed')({ export const Route = createFileRoute('/embed')({
beforeLoad: async ({ context, matches }) => { beforeLoad: async ({ context, matches }) => {
const user = await prefetchGetMyUserInfo(context.queryClient); const token = await getSupabaseSession();
if (!user) await signInWithAnonymousUser(); //we fallback to an anonymous user if (token.accessToken) await prefetchGetMyUserInfo(context.queryClient);
else await signInWithAnonymousUser(); //we fallback to an anonymous user
const assetType = [...matches].reverse().find(({ staticData }) => staticData?.assetType) const assetType = [...matches].reverse().find(({ staticData }) => staticData?.assetType)
?.staticData?.assetType as AssetType; ?.staticData?.assetType as AssetType;