fix apply the plan docs/alrahma_api_fix_plan_school_year_only_v7
This commit is contained in:
+7
-2
@@ -1,5 +1,5 @@
|
||||
import { apiUrl } from '../lib/apiOrigin'
|
||||
import { selectedSchoolYearHeaders } from '../lib/schoolYearSelection'
|
||||
import { selectedSchoolYearHeaders, withSelectedSchoolYearUrl } from '../lib/schoolYearSelection'
|
||||
|
||||
const TOKEN_KEY = 'alrahma_api_token'
|
||||
|
||||
@@ -39,6 +39,10 @@ export function applyStoredSchoolYearHeaders(headers: Headers): Headers {
|
||||
return headers
|
||||
}
|
||||
|
||||
export function withStoredSchoolYearUrl(url: string): string {
|
||||
return withSelectedSchoolYearUrl(url)
|
||||
}
|
||||
|
||||
export class ApiHttpError extends Error {
|
||||
readonly status: number
|
||||
readonly body: unknown
|
||||
@@ -73,7 +77,8 @@ export async function apiFetch<T>(
|
||||
applyStoredSchoolYearHeaders(headers)
|
||||
}
|
||||
|
||||
const url = apiUrl(path)
|
||||
const method = String(init.method ?? 'GET').toUpperCase()
|
||||
const url = apiUrl(method === 'GET' ? withStoredSchoolYearUrl(path) : path)
|
||||
|
||||
let res: Response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user