feat(cookies): using HTTP setCookie instead of manually doing it
This commit is contained in:
@@ -25,8 +25,7 @@ export const Login: Component = () => {
|
||||
throw new Error("bruh, no code");
|
||||
}
|
||||
|
||||
const res = await postCode(email.toString(), code.toString());
|
||||
console.log(res);
|
||||
await postCode(email.toString(), code.toString());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -124,22 +124,12 @@ export const postLogin = async (email: string): Promise<void> => {
|
||||
await fetch(request);
|
||||
};
|
||||
|
||||
const codeValidator = strictObject({
|
||||
access: string(),
|
||||
refresh: string(),
|
||||
});
|
||||
|
||||
export const postCode = async (
|
||||
email: string,
|
||||
code: string,
|
||||
): Promise<InferOutput<typeof codeValidator>> => {
|
||||
export const postCode = async (email: string, code: string): Promise<void> => {
|
||||
const request = getBaseRequest({
|
||||
path: "code",
|
||||
body: JSON.stringify({ email, code }),
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
const res = await fetch(request).then((res) => res.json());
|
||||
|
||||
return parse(codeValidator, res);
|
||||
await fetch(request).then((res) => res.json());
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user