From de7f5059fbd95049219af09929b43352f7da0dc8 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Fri, 27 Dec 2024 12:09:12 +0100 Subject: [PATCH] :recycle: [#574] Refactor endpoints in frontend --- frontend/.storybook/mockData.ts | 6 +++--- frontend/src/lib/api/archivist.ts | 2 +- frontend/src/lib/api/recordManagers.ts | 2 +- frontend/src/lib/api/reviewers.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/.storybook/mockData.ts b/frontend/.storybook/mockData.ts index 5171a98b..3fcae104 100644 --- a/frontend/.storybook/mockData.ts +++ b/frontend/.storybook/mockData.ts @@ -117,19 +117,19 @@ export const MOCKS = { response: usersFactory(), }, RECORD_MANAGERS: { - url: "http://localhost:8000/api/v1/record-managers/", + url: "http://localhost:8000/api/v1/users?role=record_manager", method: "GET", status: 200, response: [recordManagerFactory()], }, REVIEWERS: { - url: "http://localhost:8000/api/v1/reviewers/", + url: "http://localhost:8000/api/v1/users?role=main_reviewer", method: "GET", status: 200, response: usersFactory(), }, CO_REVIEWERS: { - url: "http://localhost:8000/api/v1/co-reviewers/", + url: "http://localhost:8000/api/v1/users?role=co_reviewer", method: "GET", status: 200, response: usersFactory(), diff --git a/frontend/src/lib/api/archivist.ts b/frontend/src/lib/api/archivist.ts index 09bcc4cb..6da7dd81 100644 --- a/frontend/src/lib/api/archivist.ts +++ b/frontend/src/lib/api/archivist.ts @@ -10,7 +10,7 @@ export type Archivist = { * List all the users that have the permission to archive destruction lists. */ export async function listArchivists() { - const response = await request("GET", "/archivists/"); + const response = await request("GET", "/users", { role: "archivist" }); const promise: Promise = response.json(); return promise; } diff --git a/frontend/src/lib/api/recordManagers.ts b/frontend/src/lib/api/recordManagers.ts index e926380b..a240f7a1 100644 --- a/frontend/src/lib/api/recordManagers.ts +++ b/frontend/src/lib/api/recordManagers.ts @@ -7,7 +7,7 @@ import { request } from "./request"; */ export async function listRecordManagers() { return cacheMemo("listRecordManagers", async () => { - const response = await request("GET", "/record-managers/"); + const response = await request("GET", "/users", { role: "record_manager" }); const promise: Promise = response.json(); return promise; }); diff --git a/frontend/src/lib/api/reviewers.ts b/frontend/src/lib/api/reviewers.ts index 2de8a733..7a8abc6d 100644 --- a/frontend/src/lib/api/reviewers.ts +++ b/frontend/src/lib/api/reviewers.ts @@ -7,7 +7,7 @@ import { request } from "./request"; */ export async function listReviewers() { return cacheMemo("listReviewers", async () => { - const response = await request("GET", "/reviewers/"); + const response = await request("GET", "/users", { role: "main_reviewer" }); const promise: Promise = response.json(); return promise; }); @@ -18,7 +18,7 @@ export async function listReviewers() { */ export async function listCoReviewers() { return cacheMemo("listCoReviewers", async () => { - const response = await request("GET", "/co-reviewers/"); + const response = await request("GET", "/users", { role: "co_reviewer" }); const promise: Promise = response.json(); return promise; });