fix: not using cookies anymore
I think Tauri doesn't like it very much
This commit is contained in:
@@ -25,7 +25,13 @@ export const Login: Component = () => {
|
||||
throw new Error("bruh, no code");
|
||||
}
|
||||
|
||||
await postCode(email.toString(), code.toString());
|
||||
const { access, refresh } = await postCode(
|
||||
email.toString(),
|
||||
code.toString(),
|
||||
);
|
||||
|
||||
localStorage.setItem("access", access);
|
||||
localStorage.setItem("refresh", refresh);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -124,12 +124,22 @@ export const postLogin = async (email: string): Promise<void> => {
|
||||
await fetch(request);
|
||||
};
|
||||
|
||||
export const postCode = async (email: string, code: string): Promise<void> => {
|
||||
const codeValidator = strictObject({
|
||||
access: string(),
|
||||
refresh: string(),
|
||||
});
|
||||
|
||||
export const postCode = async (
|
||||
email: string,
|
||||
code: string,
|
||||
): Promise<InferOutput<typeof codeValidator>> => {
|
||||
const request = getBaseRequest({
|
||||
path: "code",
|
||||
body: JSON.stringify({ email, code }),
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
await fetch(request).then((res) => res.json());
|
||||
const res = await fetch(request).then((res) => res.json());
|
||||
|
||||
return parse(codeValidator, res);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user