Merge pull request #652 from LAION-AI/238-admin-view-user-messages

Displaying a different user's messages in the admin view
This commit is contained in:
AbdBarho
2023-01-13 07:11:04 +01:00
committed by GitHub
4 changed files with 105 additions and 44 deletions
@@ -0,0 +1,16 @@
import { withRole } from "src/lib/auth";
const handler = withRole("admin", async (req, res) => {
const { user } = req.query;
const messagesRes = await fetch(`${process.env.FASTAPI_URL}/api/v1/frontend_users/local/${user}/messages`, {
method: "GET",
headers: {
"X-API-Key": process.env.FASTAPI_KEY,
},
});
const messages = await messagesRes.json();
res.status(200).json(messages);
});
export default handler;