Files
koin_ping_0.2.0/frontend/src/api/account.js
KS Jannette 4b77e7a4d4
Some checks are pending
check / check (push) Waiting to run
add user account page and associated functionaility to support it
2026-03-05 08:25:24 -05:00

26 lines
772 B
JavaScript

import { getAuthHeaders } from "./authHeaders";
import { API_BASE } from "./config";
export async function getAccount() {
const headers = await getAuthHeaders();
const res = await fetch(`${API_BASE}/user/account`, { headers });
if (!res.ok) {
const data = await res.json();
throw new Error(data.message || "Failed to load account");
}
return res.json();
}
export async function createPortalSession() {
const headers = await getAuthHeaders();
const res = await fetch(`${API_BASE}/stripe/create-portal-session`, {
method: "POST",
headers,
});
if (!res.ok) {
const data = await res.json();
throw new Error(data.message || "Failed to create portal session");
}
return res.json();
}