updating iframe auth handling
This commit is contained in:
+18
-8
@@ -26,6 +26,7 @@ const App: Component = () => {
|
||||
|
||||
onMount(() => {
|
||||
const removeListener = pb.authStore.onChange((token) => {
|
||||
console.log('[DEBUG] pb.authStore.onChange fired, token present:', !!token);
|
||||
setIsAuthenticated(!!token);
|
||||
if (token) {
|
||||
initStore();
|
||||
@@ -56,13 +57,22 @@ const App: Component = () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Determine if we are in an embed route
|
||||
const isEmbed = () => window.location.pathname.startsWith('/embed/');
|
||||
const embedView = () => {
|
||||
// Determine if we are in an embed route (check both path and hash for compatibility)
|
||||
const isEmbed = () => {
|
||||
const path = window.location.pathname;
|
||||
if (path.includes('/notes')) return 'embed_notes';
|
||||
if (path.includes('/quick-add')) return 'embed_quick_add';
|
||||
return null;
|
||||
const hash = window.location.hash;
|
||||
const res = path.startsWith('/embed/') || hash.startsWith('#/embed/');
|
||||
console.log('[DEBUG] isEmbed check:', { res, path, hash, href: window.location.href });
|
||||
return res;
|
||||
};
|
||||
|
||||
const getEmbedView = () => {
|
||||
const fullPath = window.location.pathname + window.location.hash;
|
||||
let view = null;
|
||||
if (fullPath.includes('/notes')) view = 'embed_notes';
|
||||
else if (fullPath.includes('/quick-add')) view = 'embed_quick_add';
|
||||
console.log('[DEBUG] getEmbedView detected:', view, 'Full URL context:', fullPath);
|
||||
return view;
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -89,10 +99,10 @@ const App: Component = () => {
|
||||
<EmbedAuthWrapper>
|
||||
<EmbedLayout>
|
||||
<Suspense fallback={<div class="flex items-center justify-center h-full"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div></div>}>
|
||||
<Show when={embedView() === "embed_notes"}>
|
||||
<Show when={getEmbedView() === "embed_notes"}>
|
||||
<EmbedNotesView />
|
||||
</Show>
|
||||
<Show when={embedView() === "embed_quick_add"}>
|
||||
<Show when={getEmbedView() === "embed_quick_add"}>
|
||||
<EmbedQuickAddView />
|
||||
</Show>
|
||||
</Suspense>
|
||||
|
||||
Reference in New Issue
Block a user