oops - put auth back in front of publish

This commit is contained in:
adueck 2023-01-22 21:03:11 +05:00
parent fcfe5cfc09
commit 6d957bc0c3
1 changed files with 15 additions and 15 deletions

View File

@ -7,23 +7,23 @@ import publish from "./publish";
export const publishDictionary = functions.runWith({
timeoutSeconds: 60,
memory: "2GB"
}).https.onRequest(async (req, res) => {
// lingdocsAuth(
// async (req, res: functions.Response<FT.PublishDictionaryResponse | FT.FunctionError>) => {
// if (req.user.level !== "editor") {
// res.status(403).send({ ok: false, error: "403 forbidden" });
// return;
// }
// try {
}).https.onRequest(
lingdocsAuth(
async (req, res: functions.Response<FT.PublishDictionaryResponse | FT.FunctionError>) => {
if (req.user.level !== "editor") {
res.status(403).send({ ok: false, error: "403 forbidden" });
return;
}
try {
const response = await publish();
res.send(response);
// } catch (e) {
// // @ts-ignore
// res.status(500).send({ ok: false, error: e.message });
// }
// }
// )
});
} catch (e) {
// @ts-ignore
res.status(500).send({ ok: false, error: e.message });
}
}
)
);
export const submissions = functions.runWith({
timeoutSeconds: 30,