cookie util
This commit is contained in:
parent
7dd52d8890
commit
f714ef3fa6
11
src/utils/cookie.js
Normal file
11
src/utils/cookie.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// utils/cookie.js
|
||||||
|
export function getJWTFromRequest(request) {
|
||||||
|
const cookies = request.headers.get("cookie") || '';
|
||||||
|
const jwtCookie = cookies.split(';').find(cookie => cookie.trim().startsWith('UserSession='));
|
||||||
|
|
||||||
|
if (jwtCookie) {
|
||||||
|
return jwtCookie.split('=')[1] || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user