File tree Expand file tree Collapse file tree 2 files changed +2
-20
lines changed Expand file tree Collapse file tree 2 files changed +2
-20
lines changed Original file line number Diff line number Diff line change 2323 "type" : " module" ,
2424 "dependencies" : {
2525 "@fontsource/fira-mono" : " ^4.2.2" ,
26- "@lukeed/uuid" : " ^2.0.0" ,
27- "cookie" : " ^0.4.1" ,
2826 "eslint" : " ^8.0.0" ,
2927 "eslint-plugin-svelte3" : " ^3.2.0" ,
3028 "eslint-scope" : " ^7.0.0" ,
Original file line number Diff line number Diff line change 1- import cookie from 'cookie' ;
2- import { v4 as uuid } from '@lukeed/uuid' ;
3-
4- export async function handle ( { request, resolve } ) {
5- const cookies = cookie . parse ( request . headers . cookie || '' ) ;
6- request . locals . userid = cookies . userid || uuid ( ) ;
7-
8- const response = await resolve ( request ) ;
9-
10- if ( ! cookies . userid ) {
11- // if this is the first time the user has visited this app,
12- // set a cookie so that we recognise them when they return
13- response . headers [ 'set-cookie' ] = cookie . serialize ( 'userid' , request . locals . userid , {
14- path : '/' ,
15- httpOnly : true
16- } ) ;
17- }
18-
1+ export async function handle ( { event, resolve } ) {
2+ const response = await resolve ( event ) ;
193 return response ;
204}
You can’t perform that action at this time.
0 commit comments