@axium/server 0.1.6 → 0.1.8
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.
package/package.json
CHANGED
package/web/lib/Icon.svelte
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { redirect } from '@sveltejs/kit';
|
|
2
2
|
import { adapter } from '../../dist/auth.js';
|
|
3
|
-
import type { PageServerLoadEvent } from './$types';
|
|
3
|
+
import type { PageServerLoadEvent } from './$types.js';
|
|
4
4
|
|
|
5
5
|
export async function load(event: PageServerLoadEvent) {
|
|
6
6
|
const session = await event.locals.auth();
|
|
7
7
|
|
|
8
8
|
if (!session) redirect(307, '/auth/signin');
|
|
9
|
-
if (!session.user.name) redirect(307, '
|
|
9
|
+
if (!session.user.name) redirect(307, 'name');
|
|
10
10
|
|
|
11
11
|
const user = await adapter.getUserByEmail(session.user.email);
|
|
12
12
|
|
package/web/routes/+page.svelte
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Icon from '../lib/Icon.svelte';
|
|
4
4
|
import '../lib/styles.css';
|
|
5
5
|
|
|
6
|
-
const { data, children } = $props();
|
|
6
|
+
const { data, children = () => {}, prefix = '' } = $props();
|
|
7
7
|
|
|
8
8
|
const { user } = data;
|
|
9
9
|
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<svelte:head>
|
|
14
|
-
<title>
|
|
14
|
+
<title>Account</title>
|
|
15
15
|
</svelte:head>
|
|
16
16
|
|
|
17
17
|
<div id="content">
|
|
18
18
|
<img id="pfp" src={image} alt="User profile" />
|
|
19
19
|
<p id="greeting">Welcome, {user.name}</p>
|
|
20
|
-
<div class="main">
|
|
20
|
+
<div class="account-section main">
|
|
21
21
|
<div>
|
|
22
22
|
<p>Name</p>
|
|
23
23
|
<p>{user.name}</p>
|
|
24
|
-
<a href="name"><Icon id="chevron-right" /></a>
|
|
24
|
+
<a href="{prefix}/name"><Icon id="chevron-right" /></a>
|
|
25
25
|
</div>
|
|
26
26
|
<div>
|
|
27
27
|
<p>Email</p>
|
|
28
28
|
<p>{user.email}</p>
|
|
29
|
-
<a href="email"><Icon id="chevron-right" /></a>
|
|
29
|
+
<a href="{prefix}/email"><Icon id="chevron-right" /></a>
|
|
30
30
|
</div>
|
|
31
31
|
<div>
|
|
32
32
|
<p>User ID <dfn title="This is your UUID."><Icon id="regular/circle-info" /></dfn></p>
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
margin-bottom: 1em;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.
|
|
60
|
+
:global(.account-section) {
|
|
61
61
|
width: 50%;
|
|
62
62
|
padding-top: 4em;
|
|
63
63
|
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.
|
|
69
|
+
:global(.account-section) > div {
|
|
70
70
|
display: grid;
|
|
71
71
|
grid-template-columns: 10em 1fr 2em;
|
|
72
72
|
align-items: center;
|
|
@@ -2,7 +2,7 @@ import { Registration } from '@axium/core/schemas';
|
|
|
2
2
|
import { fail, redirect } from '@sveltejs/kit';
|
|
3
3
|
import * as auth from '../../../dist/auth.js';
|
|
4
4
|
import * as config from '../../../dist/config.js';
|
|
5
|
-
import type { Actions } from './$types';
|
|
5
|
+
import type { Actions } from './$types.js';
|
|
6
6
|
|
|
7
7
|
export function load() {
|
|
8
8
|
if (!config.auth.credentials) return redirect(307, '/auth/signin');
|