Skip to content

Commit 82ebb12

Browse files
testing out dynamic import of firebase inside LoginCard.svelte ...but for now the onMount logic effectively does the same as importing at the top of the component
1 parent 68aec55 commit 82ebb12

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

.svelte-kit/ambient.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ declare module '$env/static/private' {
123123
export const npm_node_execpath: string;
124124
export const npm_config_prefix: string;
125125
export const COLORTERM: string;
126-
export const NODE_ENV: string;
127126
}
128127

129128
/**
@@ -257,7 +256,6 @@ declare module '$env/dynamic/private' {
257256
npm_node_execpath: string;
258257
npm_config_prefix: string;
259258
COLORTERM: string;
260-
NODE_ENV: string;
261259
[key: `PUBLIC_${string}`]: undefined;
262260
[key: string]: string | undefined;
263261
}

src/.DS_Store

2 KB
Binary file not shown.

src/lib/Login/LoginCard.svelte

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
// TODO: commented out on dec12, 2022 due to dynamicimporting
99
// import { app, auth } from "$lib/firebase";
10+
// import { auth } from "$lib/firebase";
1011
// import { onAuthStateChanged, isSignInWithEmailLink } from "firebase/auth";
1112
1213
import { onMount } from "svelte";
@@ -50,8 +51,10 @@
5051
async function onMountFirebase() {
5152
// TODO:dynamic importing added on dec12,2022
5253
const { auth } = await import("$lib/firebase");
53-
const { onAuthStateChanged } = await import("firebase/auth");
54-
const { isSignInWithEmailLink } = await import("firebase/auth");
54+
const { onAuthStateChanged, isSignInWithEmailLink } = await import(
55+
"firebase/auth"
56+
);
57+
5558
// Confirm the link is a sign-in with email link.
5659
5760
if (isSignInWithEmailLink(auth, window.location.href)) {
@@ -96,14 +99,24 @@
9699
});
97100
// }
98101
}
102+
// globalThis.loginFirstClickHappened = false;
103+
// $: if ($showLoginModal == true && !globalThis.loginFirstClickHappened) {
104+
// onMountFirebase();
105+
// globalThis.loginFirstClickHappened = true;
106+
// }
107+
108+
// TODO: placing 'onMountFirebase()' inside an onclick .. requires to click twice...???
99109
100110
onMount(() => {
101-
document.querySelector('a[href="/login"]').addEventListener("click", () => {
102-
if (!globalThis.loginFirstClickHappened) {
103-
onMountFirebase();
104-
globalThis.loginFirstClickHappened = true;
105-
}
106-
});
111+
onMountFirebase();
112+
// document
113+
// .querySelector('a[href="/login"]')
114+
// .addEventListener("dblclick", () => {
115+
// if (!globalThis.loginFirstClickHappened) {
116+
// onMountFirebase();
117+
// globalThis.loginFirstClickHappened = true;
118+
// }
119+
// });
107120
});
108121
109122
// Hoisted Functions

src/lib/Modal.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
? `${bgTint} `
1212
: 'hidden'} overflow-y-scroll overflow-x-clip"
1313
>
14+
<!-- {#if showModal} -->
1415
<slot />
16+
<!-- {/if} -->
1517
</button>
1618

1719
<!-- switched from 'hidden' to opacity-0... otherwise tailwind animations aren't working on this

0 commit comments

Comments
 (0)