Complete the handler todo and use withoutRole

This commit is contained in:
Keith Stevens
2023-01-11 16:54:39 +09:00
parent aba5b43a37
commit 9f1064d656
+4 -15
View File
@@ -1,23 +1,12 @@
import { getToken } from "next-auth/jwt";
import { withoutRole } from "src/lib/auth";
import { oasstApiClient } from "src/lib/oasst_api_client";
/**
* TODO
* Returns the set of valid labels that can be applied to messages.
*/
const handler = async (req, res) => {
const token = await getToken({ req });
// Return nothing if the user isn't registered.
if (!token) {
res.status(401).end();
return;
}
// Fetch the new task.
const handler = withoutRole("banned", async (req, res) => {
const valid_labels = await oasstApiClient.fetch_valid_text();
// Send the results to the client.
res.status(200).json(valid_labels);
};
});
export default handler;