From a75c13ef423d99ea210284d767c63de158635fea Mon Sep 17 00:00:00 2001 From: ml729 <85370083+ml729@users.noreply.github.com> Date: Sat, 21 Jan 2023 13:13:15 -0500 Subject: [PATCH] use getBackendUserCore for taskAvailability --- website/src/pages/api/admin/status.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/website/src/pages/api/admin/status.ts b/website/src/pages/api/admin/status.ts index fb93740f..64299db8 100644 --- a/website/src/pages/api/admin/status.ts +++ b/website/src/pages/api/admin/status.ts @@ -1,17 +1,14 @@ import { getToken } from "next-auth/jwt"; import { withRole } from "src/lib/auth"; import { oasstApiClient } from "src/lib/oasst_api_client"; +import { getBackendUserCore } from "src/lib/users"; /** * Returns tasks availability, stats, and tree manager stats. */ const handler = withRole("admin", async (req, res) => { const token = await getToken({ req }); - const currentUser = { - id: token.sub, - display_name: token.name, - auth_method: "local", - }; + const currentUser = await getBackendUserCore(token.sub); const [tasksAvailabilityData, statsData, treeManagerData] = await Promise.all([ oasstApiClient.fetch_tasks_availability(currentUser), oasstApiClient.fetch_stats(),