mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-08-07 11:17:38 +08:00
use getBackendUserCore for taskAvailability
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user