hack: allowing demo@email.com to login straight away for test flight submittion

This commit is contained in:
2025-05-10 21:03:32 +01:00
parent cc07ef983f
commit b97eae10a3
3 changed files with 62 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ type BaseRequestParams = Partial<{
method: "GET" | "POST";
}>;
export const base = "http://localhost:3040";
export const base = "https://haystack.johncosta.tech";
const getBaseRequest = ({ path, body, method }: BaseRequestParams): Request => {
return new Request(`${base}/${path}`, {
@@ -202,6 +202,18 @@ export const postLogin = async (email: string): Promise<void> => {
await fetch(request);
};
export const postDemoLogin = async (): Promise<
InferOutput<typeof codeValidator>
> => {
const request = getBaseRequest({
path: "demo-login",
});
const res = await fetch(request).then((res) => res.json());
return parse(codeValidator, res);
};
const codeValidator = strictObject({
access: string(),
refresh: string(),