File tree 2 files changed +8
-3
lines changed
packages/create-svelte/templates/default/src
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' create-svelte ' : patch
3
+ ---
4
+
5
+ Make hooks file comply with TypeScript strictest mode
Original file line number Diff line number Diff line change 1
- import cookie from 'cookie' ;
2
1
import { v4 as uuid } from '@lukeed/uuid' ;
3
2
import type { Handle } from '@sveltejs/kit' ;
3
+ import * as cookie from 'cookie' ;
4
4
5
5
/** @type {import('@sveltejs/kit').Handle } */
6
6
export const handle : Handle = async ( { event, resolve } ) => {
7
7
const cookies = cookie . parse ( event . request . headers . get ( 'cookie' ) || '' ) ;
8
- event . locals . userid = cookies . userid || uuid ( ) ;
8
+ event . locals . userid = cookies [ ' userid' ] || uuid ( ) ;
9
9
10
10
const response = await resolve ( event ) ;
11
11
12
- if ( ! cookies . userid ) {
12
+ if ( ! cookies [ ' userid' ] ) {
13
13
// if this is the first time the user has visited this app,
14
14
// set a cookie so that we recognise them when they return
15
15
response . headers . set (
You can’t perform that action at this time.
0 commit comments