refactor: ♻️ remove code duplication
This commit is contained in:
parent
7ea95c67c4
commit
ca482e8956
|
@ -10,12 +10,10 @@ export async function handler(request: Request, ctx: FreshContext) {
|
||||||
response.headers.set('Service-Worker-Allowed', '/')
|
response.headers.set('Service-Worker-Allowed', '/')
|
||||||
}
|
}
|
||||||
|
|
||||||
const cookies = getCookies(request.headers)
|
|
||||||
|
|
||||||
// Start session
|
// Start session
|
||||||
if (SessionStore.getSession(cookies['_SESSION'] ?? '') === undefined) {
|
if (SessionStore.getFromRequest(request) === undefined) {
|
||||||
// Clear outdated cookies
|
// Clear outdated cookies
|
||||||
for (const cookie in cookies) {
|
for (const cookie in getCookies(request.headers)) {
|
||||||
setCookie(response.headers, {
|
setCookie(response.headers, {
|
||||||
name: cookie,
|
name: cookie,
|
||||||
value: '',
|
value: '',
|
||||||
|
|
Loading…
Reference in a new issue