use getBackendUserCore for taskAvailability

This commit is contained in:
ml729
2023-01-21 13:13:15 -05:00
parent 4dd809585e
commit a75c13ef42
+2 -5
View File
@@ -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(),