Skip to content

Commit

Permalink
feat: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
0x15f committed Aug 2, 2022
1 parent 25b3865 commit 36344d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/request.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import config from '../../cart.config'
import { parse } from './cookie'
import { decrypt } from './encrypt';
import { decrypt } from './encrypt'

export default async function useRequest(request: Request): Promise<{ host: string; cartToken: string; }> {
export default async function useRequest(
request: Request,
): Promise<{ host: string; cartToken: string }> {
const cookie = parse(request.headers.get('Cookie') || '')
const cartToken = await decrypt(cookie[config.cookie.name]) ?? config.cookie.generator()
const cartToken = (await decrypt(cookie[config.cookie.name])) ?? config.cookie.generator()
const host = new URL(request.url).hostname

return {
Expand Down

0 comments on commit 36344d6

Please sign in to comment.