Scheduling infrastructure for absolutely everyone.
Fixing api points not returning (#2419)
sean-brydonfefc314d35d4
diff --git a/packages/app-store/slackmessaging/api/add.ts b/packages/app-store/slackmessaging/api/add.tsindex 5ccf21c4701..e4aa5143d52 100644--- a/packages/app-store/slackmessaging/api/add.ts+++ b/packages/app-store/slackmessaging/api/add.ts@@ -8,8 +8,7 @@ const scopes = ["commands", "users:read", "users:read.email"];export default async function handler(req: NextApiRequest, res: NextApiResponse) {if (!req.session?.user?.id) {- res.status(401).json({ message: "You must be logged in to do this" });- return;+ return res.status(401).json({ message: "You must be logged in to do this" });}if (req.method === "GET") {@@ -31,7 +30,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)const url = `https://slack.com/oauth/v2/authorize?${query}&user_`;// const url =// "https://slack.com/oauth/v2/authorize?client_id=3194129032064.3178385871204&scope=chat:write,commands&user_scope=";- res.status(200).json({ url });+ return res.status(200).json({ url });}- res.status(404).json({ error: "Not Found" });+ return res.status(404).json({ error: "Not Found" });}diff --git a/packages/app-store/slackmessaging/api/callback.ts b/packages/app-store/slackmessaging/api/callback.tsindex 6fca42be36d..20541a0ff11 100644--- a/packages/app-store/slackmessaging/api/callback.ts+++ b/packages/app-store/slackmessaging/api/callback.ts@@ -8,14 +8,12 @@ const client_secret = process.env.SLACK_CLIENT_SECRET;export default async function handler(req: NextApiRequest, res: NextApiResponse) {if (!req.session?.user?.id) {- res.status(401).json({ message: "You must be logged in to do this" });- return;+ return res.status(401).json({ message: "You must be logged in to do this" });}if (req.method === "GET") {// Get userconst { code } = req.query;- console.log(req.query);if (!code) {res.redirect("/apps/installed"); // Redirect to where the user was if they cancel the signup or if the oauth fails@@ -46,6 +44,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)},},});- res.redirect("/apps/installed");+ return res.redirect("/apps/installed");}}diff --git a/packages/app-store/slackmessaging/api/commandHandler.ts b/packages/app-store/slackmessaging/api/commandHandler.tsindex 4af418dab37..57845cb3ec4 100644--- a/packages/app-store/slackmessaging/api/commandHandler.ts+++ b/packages/app-store/slackmessaging/api/commandHandler.ts@@ -24,5 +24,5 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)return res.status(404).json({ message: `Command not found` });}}- res.status(400).json({ message: "Invalid request" });+ return res.status(400).json({ message: "Invalid request" });}diff --git a/packages/app-store/slackmessaging/api/interactiveHandler.ts b/packages/app-store/slackmessaging/api/interactiveHandler.tsindex 740e666048f..290c4774a13 100644--- a/packages/app-store/slackmessaging/api/interactiveHandler.ts+++ b/packages/app-store/slackmessaging/api/interactiveHandler.ts@@ -16,8 +16,8 @@ export default async function interactiveHandler(req: NextApiRequest, res: NextAcase InteractionEvents.CREATE_EVENT:return await createEvent(req, res);default:- res.status(200).end(); // Techincally an invalid request but we don't want to return an throw an error to slack - 200 just does nothing+ return res.status(200).end(); // Techincally an invalid request but we don't want to return an throw an error to slack - 200 just does nothing}}- res.status(200).end(); // Send 200 if we dont have a case for the action_id+ return res.status(200).end(); // Send 200 if we dont have a case for the action_id}