Skip to content

Commit

Permalink
Fixing api points not returning (#2419)
Browse files Browse the repository at this point in the history
Co-authored-by: Omar López <zomars@me.com>
  • Loading branch information
sean-brydon and zomars committed Apr 7, 2022
1 parent 06df6c9 commit fefc314
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
7 changes: 3 additions & 4 deletions packages/app-store/slackmessaging/api/add.ts
Expand Up @@ -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") {
Expand All @@ -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" });
}
6 changes: 2 additions & 4 deletions packages/app-store/slackmessaging/api/callback.ts
Expand Up @@ -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 user
const { 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
Expand Down Expand Up @@ -46,6 +44,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
},
},
});
res.redirect("/apps/installed");
return res.redirect("/apps/installed");
}
}
2 changes: 1 addition & 1 deletion packages/app-store/slackmessaging/api/commandHandler.ts
Expand Up @@ -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" });
}
4 changes: 2 additions & 2 deletions packages/app-store/slackmessaging/api/interactiveHandler.ts
Expand Up @@ -16,8 +16,8 @@ export default async function interactiveHandler(req: NextApiRequest, res: NextA
case 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
}

1 comment on commit fefc314

@vercel
Copy link

@vercel vercel bot commented on fefc314 Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

calendso – ./apps/web

app.calendso.com
app.cal.com
calendso-cal.vercel.app
calendso-git-main-cal.vercel.app

Please sign in to comment.