import routes from "@/routes";
import { getBaseHeaders } from "../utils";

export interface Payload {
    email: string;
    locale: string;
    timezone: string;
    password: string;
}

export type Response = {
    status: string,
    message: string
} | {
    token: string;
    userId: string;
}

export const createRequest = (data: Payload) => {
    const url = new URL(routes.server.login());
    const body = JSON.stringify(data);
    return new Request(url, {
        method: "POST",
        body,
        headers: getBaseHeaders()
    });
};
