sveltekit-auth-example 1.0.15 → 1.0.16

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/CHANGELOG.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Backlog
2
- * [Bug] Address TypeScript issues found during `npm run check` (11 errors) - most related to use of Action type
3
2
  * Consider not setting defaultUser in loginSession as it would simplify +layout.svelte.
4
3
  * Refactor $env/dynamic/private and public
5
4
  * Add password complexity checking on /register and /profile pages (only checks for length currently despite what the pages say)
6
5
 
6
+ # 1.0.16
7
+ * [Bug] Fixed LayoutServerLoad typing
8
+
7
9
  # 1.0.15
8
10
  * [Bug] Replaced use of Action type in +server.ts files (only works for +page.server.ts)
9
11
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sveltekit-auth-example",
3
3
  "description": "SvelteKit Authentication Example",
4
- "version": "1.0.15",
4
+ "version": "1.0.16",
5
5
  "private": false,
6
6
  "author": "Nate Stuyvesant",
7
7
  "license": "https://github.com/nstuyvesant/sveltekit-auth-example/blob/master/LICENSE",
@@ -63,7 +63,7 @@
63
63
  "prettier-plugin-svelte": "^2.7.0",
64
64
  "sass": "^1.54.5",
65
65
  "svelte": "^3.49.0",
66
- "svelte-check": "^2.8.1",
66
+ "svelte-check": "^2.9.0",
67
67
  "svelte-preprocess": "^4.10.7",
68
68
  "tslib": "^2.4.0",
69
69
  "typescript": "^4.7.4",
@@ -1,6 +1,7 @@
1
1
  import type { LayoutServerLoad } from './$types'
2
2
 
3
- export function load({ locals }): LayoutServerLoad {
3
+ export const load: LayoutServerLoad = (event) => {
4
+ const locals = event.locals
4
5
  const { user }: { user: User } = locals // locals.user set by hooks.ts/handle(), undefined if not logged in
5
6
  return {
6
7
  user
@@ -1,13 +1,13 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from 'svelte'
3
- import type { LayoutData } from './$types'
3
+ import type { LayoutServerData } from './$types'
4
4
  import { goto } from '$app/navigation'
5
5
  import { page } from '$app/stores'
6
6
  import { loginSession, toast } from '../stores'
7
7
  import useAuth from '$lib/auth'
8
8
  import 'bootstrap/scss/bootstrap.scss' // preferred way to load Bootstrap SCSS for hot module reloading
9
9
 
10
- export let data: LayoutData
10
+ export let data: LayoutServerData
11
11
 
12
12
  // If returning from different website, runs once (as it's an SPA) to restore user session if session cookie is still valid
13
13
  const { user } = data
@@ -1,4 +1,5 @@
1
- import { error, json, type RequestHandler } from '@sveltejs/kit'
1
+ import { error, json} from '@sveltejs/kit'
2
+ import type { RequestHandler } from './$types'
2
3
  import { query } from '../../../_db'
3
4
 
4
5
  export const PUT: RequestHandler = async event => {
@@ -1,4 +1,5 @@
1
- import { error, json, type RequestHandler } from '@sveltejs/kit'
1
+ import { error, json } from '@sveltejs/kit'
2
+ import type { RequestHandler } from './$types'
2
3
  import { query } from '../../_db'
3
4
 
4
5
  export const POST: RequestHandler = async (event) => {
@@ -1,4 +1,4 @@
1
- import type { RequestHandler } from '@sveltejs/kit'
1
+ import type { RequestHandler } from './$types'
2
2
  import type { Secret } from 'jsonwebtoken'
3
3
  import jwt from 'jsonwebtoken'
4
4
  import dotenv from 'dotenv'
@@ -1,4 +1,5 @@
1
- import { error, type RequestHandler } from '@sveltejs/kit'
1
+ import { error } from '@sveltejs/kit'
2
+ import type { RequestHandler } from './$types'
2
3
  import { OAuth2Client } from 'google-auth-library'
3
4
  import { query } from '../../_db';
4
5
  import { config } from '$lib/config'
@@ -1,6 +1,6 @@
1
1
  import { json as json$1 } from '@sveltejs/kit';
2
2
  import dotenv from 'dotenv'
3
- import type { RequestHandler } from '@sveltejs/kit'
3
+ import type { RequestHandler } from './$types'
4
4
  import type { JwtPayload } from 'jsonwebtoken'
5
5
  import jwt from 'jsonwebtoken'
6
6
  import { query } from '../../_db'