@functionalcms/svelte-components 4.8.1 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,14 +19,13 @@ const createUserSession = async (provider, event, sessionProvider) => {
|
|
|
19
19
|
const token = await provider.getValidation(event);
|
|
20
20
|
const session = await provider.getUser(token);
|
|
21
21
|
const headers = new Headers();
|
|
22
|
-
debugger;
|
|
23
22
|
if (session !== undefined) {
|
|
24
23
|
session.userId = session.sub;
|
|
25
24
|
event.locals.session = session;
|
|
26
25
|
event.locals.accessToken = token.access_token;
|
|
27
26
|
const sessionId = await sessionProvider.createSession({ session, token }, token.expires_in);
|
|
28
27
|
const retrunToAddress = event.cookies.get("retrunToAddress");
|
|
29
|
-
headers.append('Location', retrunToAddress
|
|
28
|
+
headers.append('Location', retrunToAddress ? retrunToAddress : provider.redirectPath);
|
|
30
29
|
headers.append('Set-Cookie', `${authSessionCookieName}=${sessionId}; HttpOnly; Secure; SameSite=Lax; Max-Age=${token.expires_in + 120}; Path=/`);
|
|
31
30
|
headers.append('Set-Cookie', `retrunToAddress=; HttpOnly; Secure; SameSite=Lax; Max-Age=${token.expires_in + 120}; Path=/`);
|
|
32
31
|
}
|
|
@@ -2,15 +2,31 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { EventHandler } from 'svelte/elements';
|
|
4
4
|
|
|
5
|
+
interface Css {
|
|
6
|
+
container: string;
|
|
7
|
+
header: string;
|
|
8
|
+
main: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
interface Props {
|
|
6
12
|
children: Snippet;
|
|
7
|
-
css:
|
|
13
|
+
css: Css;
|
|
8
14
|
isOpen: boolean;
|
|
9
|
-
onClose
|
|
10
|
-
|
|
15
|
+
onClose?: EventHandler<Event, HTMLDialogElement> | undefined;
|
|
16
|
+
showHeader?: boolean;
|
|
17
|
+
title?: string;
|
|
18
|
+
showCloseButton?: boolean;
|
|
11
19
|
}
|
|
12
20
|
|
|
13
|
-
let {
|
|
21
|
+
let {
|
|
22
|
+
children,
|
|
23
|
+
onClose,
|
|
24
|
+
css = { container:'', header:'', main:'', },
|
|
25
|
+
isOpen = false,
|
|
26
|
+
showHeader = true,
|
|
27
|
+
title = '',
|
|
28
|
+
showCloseButton = true,
|
|
29
|
+
}: Props = $props();
|
|
14
30
|
let dialog: any;
|
|
15
31
|
|
|
16
32
|
export function showModal() {
|
|
@@ -20,11 +36,21 @@
|
|
|
20
36
|
dialog.close();
|
|
21
37
|
}
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
if (isOpen) {
|
|
40
|
+
dialog.showModal();
|
|
41
|
+
}
|
|
26
42
|
</script>
|
|
27
43
|
|
|
28
|
-
<dialog bind:this={dialog} onclose={onClose} class={css}>
|
|
29
|
-
{
|
|
44
|
+
<dialog bind:this={dialog} onclose={onClose} class={css.container}>
|
|
45
|
+
{#if showHeader}
|
|
46
|
+
<header class={css.header}>
|
|
47
|
+
<h2>{title}</h2>
|
|
48
|
+
{#if showCloseButton}
|
|
49
|
+
<button class="close-button" onclick={close}>X</button>
|
|
50
|
+
{/if}
|
|
51
|
+
</header>
|
|
52
|
+
{/if}
|
|
53
|
+
<main class={css.main}>
|
|
54
|
+
{@render children?.()}
|
|
55
|
+
</main>
|
|
30
56
|
</dialog>
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { EventHandler } from 'svelte/elements';
|
|
3
|
+
interface Css {
|
|
4
|
+
container: string;
|
|
5
|
+
header: string;
|
|
6
|
+
main: string;
|
|
7
|
+
}
|
|
3
8
|
interface Props {
|
|
4
9
|
children: Snippet;
|
|
5
|
-
css:
|
|
10
|
+
css: Css;
|
|
6
11
|
isOpen: boolean;
|
|
7
|
-
onClose
|
|
8
|
-
|
|
12
|
+
onClose?: EventHandler<Event, HTMLDialogElement> | undefined;
|
|
13
|
+
showHeader?: boolean;
|
|
14
|
+
title?: string;
|
|
15
|
+
showCloseButton?: boolean;
|
|
9
16
|
}
|
|
10
17
|
declare const Dialog: import("svelte").Component<Props, {
|
|
11
18
|
showModal: () => void;
|