feat: stripe handlers and fetchers

This commit is contained in:
Mythie
2023-05-05 20:08:18 +10:00
parent ed3e4d22ef
commit 900b816ae0
6 changed files with 263 additions and 1 deletions

View File

@ -0,0 +1,19 @@
import { PortalSessionRequest, PortalSessionResponse } from "../handlers/portal-session";
export type FetchPortalSessionOptions = PortalSessionRequest["body"];
export const fetchPortalSession = async ({ id }: FetchPortalSessionOptions) => {
const response = await fetch("/api/stripe/portal-session", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
id,
}),
});
const json: PortalSessionResponse = await response.json();
return json;
};