From ac7f890ea8b6db933222beba87390a8dc9416bbc Mon Sep 17 00:00:00 2001 From: brage-andreas Date: Fri, 13 Sep 2024 13:16:49 +0200 Subject: [PATCH] feat: add `getMarkRules` --- src/profile/api/penalties.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/profile/api/penalties.ts b/src/profile/api/penalties.ts index 7bbed281..e737680e 100644 --- a/src/profile/api/penalties.ts +++ b/src/profile/api/penalties.ts @@ -1,10 +1,12 @@ import { get, IAPIData } from 'common/utils/api'; -import { IMark, ISuspension } from '../models/Penalty'; +import { IMark, IMarkRule, ISuspension } from '../models/Penalty'; import { getUser } from 'authentication/api'; -const API_URL = '/api/v1/profile'; +const BASE_API_URL = '/api/v1'; +const API_URL = BASE_API_URL + '/profile'; const MARKS_URL = API_URL + '/marks/'; +const MARK_RULES_URL = BASE_API_URL + '/marks/rule-sets/'; const SUSPENSIONS_URL = API_URL + '/suspensions/'; /** @@ -16,6 +18,14 @@ export const getMarks = async (): Promise => { return results; }; +/** + * @summary Fetch Mark Rules from API. + */ +export const getMarkRules = async (): Promise => { + const { results } = await get>(MARK_RULES_URL, { format: 'json' }); + return results; +}; + /** * @summary Fetch Suspensions from API. */