mirror of
https://github.com/vercel/commerce.git
synced 2025-07-13 07:51:26 +00:00
Refactored login.ts
This commit is contained in:
parent
a122d68a2c
commit
e79821bdae
@ -25,16 +25,17 @@ const login: LoginEndpoint['handlers']['login'] = async ({
|
||||
}
|
||||
try {
|
||||
|
||||
response = await config.fetch(loginMutation, { variables: { loginInput : { username: email, password }}})
|
||||
const variables = { loginInput : { username: email, password }};
|
||||
response = await config.fetch(loginMutation, { variables: variables})
|
||||
const { account: token } = response.data;
|
||||
|
||||
|
||||
const authCookie = prepareSetCookie(
|
||||
config.customerCookie,
|
||||
JSON.stringify(token),
|
||||
token.accessTokenExpiration ? { expires: new Date(token.accessTokenExpiration) }: {},
|
||||
)
|
||||
setCookies(res, [authCookie])
|
||||
|
||||
|
||||
} catch (error) {
|
||||
// Check if the email and password didn't match an existing account
|
||||
if (
|
||||
|
Loading…
x
Reference in New Issue
Block a user