44 lines
842 B
TypeScript
44 lines
842 B
TypeScript
import routes from "@/routes";
|
|
|
|
export interface Payload {
|
|
locale: string;
|
|
}
|
|
|
|
export interface Response {
|
|
sub_plans: ISubscriptionPlan[];
|
|
}
|
|
|
|
export interface ISubscriptionPlan {
|
|
id: string;
|
|
name: string;
|
|
desc: string;
|
|
provider: "stripe" | "paypal";
|
|
interval: "week" | "month" | "year";
|
|
price_cents: number;
|
|
trial: ITrial | null;
|
|
}
|
|
|
|
export interface ITrial {
|
|
is_paid: boolean;
|
|
is_free: boolean;
|
|
days: number;
|
|
price_cents: number;
|
|
}
|
|
|
|
export interface AssetMetadata {
|
|
size: number;
|
|
width: number;
|
|
height: number;
|
|
filename: string;
|
|
mime_type: string;
|
|
}
|
|
|
|
export const createRequest = ({ locale }: Payload): Request => {
|
|
const url = new URL(routes.server.subscriptionPlans());
|
|
const query = new URLSearchParams({ locale });
|
|
|
|
url.search = query.toString();
|
|
|
|
return new Request(url, { method: "GET" });
|
|
};
|