31 lines
692 B
TypeScript
31 lines
692 B
TypeScript
import routes from "@/routes";
|
|
import { getAuthHeaders } from "../utils";
|
|
|
|
export enum PDFKey {
|
|
Compatibility = "compatibility",
|
|
Palmistry = "palmistry",
|
|
}
|
|
|
|
interface Payload {
|
|
token: string;
|
|
key: PDFKey;
|
|
}
|
|
|
|
export type PayloadGet = Payload;
|
|
|
|
export interface IUserPDF {
|
|
id: string | null;
|
|
status: "ready" | string;
|
|
type: string;
|
|
url: string | undefined | null;
|
|
}
|
|
|
|
type ResponseGetSuccess = IUserPDF;
|
|
|
|
export type ResponseGet = ResponseGetSuccess;
|
|
|
|
export const createRequest = ({ token, key }: PayloadGet): Request => {
|
|
const url = new URL(routes.server.getUserPDF(key));
|
|
return new Request(url, { method: "GET", headers: getAuthHeaders(token) });
|
|
};
|