30 lines
675 B
TypeScript
30 lines
675 B
TypeScript
import routes from "@/routes";
|
|
import { getAuthHeaders } from "../utils";
|
|
|
|
interface Payload {
|
|
token: string;
|
|
}
|
|
|
|
export interface PayloadGet extends Payload {
|
|
productKey: string;
|
|
email: string;
|
|
}
|
|
|
|
interface ResponseGetSuccess {
|
|
status: string;
|
|
type: string;
|
|
active: boolean;
|
|
}
|
|
|
|
interface ResponseGetError {
|
|
status: string;
|
|
message: string;
|
|
}
|
|
|
|
export type ResponseGet = ResponseGetSuccess | ResponseGetError;
|
|
|
|
export const createRequest = ({ token, productKey, email }: PayloadGet): Request => {
|
|
const url = new URL(routes.server.dApiCheckProductPurchased(productKey, email));
|
|
return new Request(url, { method: "GET", headers: getAuthHeaders(token) });
|
|
};
|