feat: protect paid courses

This commit is contained in:
swve 2024-11-02 23:16:33 +01:00
parent b7f09885df
commit 3988ee1d4b
9 changed files with 266 additions and 33 deletions

View file

@ -10,6 +10,15 @@ export async function getPaymentConfigs(orgId: number, access_token: string) {
return res;
}
export async function checkPaidAccess(courseId: number, orgId: number, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/courses/${courseId}/access`,
RequestBodyWithAuthHeader('GET', null, null, access_token)
);
const res = await errorHandling(result);
return res;
}
export async function createPaymentConfig(orgId: number, data: any, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/config`,