mirror of https://github.com/buster-so/buster.git
Merge pull request #1155 from buster-so/big-nate-bus-1947-public-url-is-requiring-me-to-log-in-to-view-it
updated the embed axios handler
This commit is contained in:
commit
468511d8cb
|
@ -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;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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}`;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue