mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use requests with auth header for home
This commit is contained in:
parent
3457b57c58
commit
9f28dfe7e8
7 changed files with 83 additions and 40 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm, errorHandling } from "@services/utils/ts/requests";
|
||||
import { RequestBody, RequestBodyForm, RequestBodyWithAuthHeader, errorHandling } from "@services/utils/ts/requests";
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
|
|
@ -9,10 +9,17 @@ import { RequestBody, RequestBodyForm, errorHandling } from "@services/utils/ts/
|
|||
export async function getOrgCourses(org_id: number, next: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}courses/org_slug/${org_id}/page/1/limit/10`, RequestBody("GET", null, next));
|
||||
const res = await errorHandling(result);
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getOrgCoursesWithAuthHeader(org_id: number, next: any, access_token: string) {
|
||||
const result: any = await fetch(`${getAPIUrl()}courses/org_slug/${org_id}/page/1/limit/10`, RequestBodyWithAuthHeader("GET", null, next, access_token));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
export async function getCourse(course_id: string, next: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}courses/${course_id}`, RequestBody("GET", null, next));
|
||||
const res = await errorHandling(result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue