mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add ability to link courses to products
This commit is contained in:
parent
3f96f1ec9f
commit
f0aeb4605c
8 changed files with 446 additions and 2 deletions
|
|
@ -46,5 +46,31 @@ export async function getProductDetails(orgId: number, productId: string, access
|
|||
return res;
|
||||
}
|
||||
|
||||
export async function linkCourseToProduct(orgId: number, productId: string, courseId: string, access_token: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/products/${productId}/courses/${courseId}`,
|
||||
RequestBodyWithAuthHeader('POST', null, null, access_token)
|
||||
);
|
||||
const res = await getResponseMetadata(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function unlinkCourseFromProduct(orgId: number, productId: string, courseId: string, access_token: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/products/${productId}/courses/${courseId}`,
|
||||
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
|
||||
);
|
||||
const res = await getResponseMetadata(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getCoursesLinkedToProduct(orgId: number, productId: string, access_token: string) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}payments/${orgId}/products/${productId}/courses`,
|
||||
RequestBodyWithAuthHeader('GET', null, null, access_token)
|
||||
);
|
||||
const res = await getResponseMetadata(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue