chore: Upgrade Prettier 1.8 -> 2.0 (#1436)
This commit is contained in:
@@ -14,7 +14,7 @@ const router = new Router();
|
||||
router.use(methodOverride());
|
||||
router.use(validation());
|
||||
|
||||
router.post("email", async ctx => {
|
||||
router.post("email", async (ctx) => {
|
||||
const { email } = ctx.body;
|
||||
|
||||
ctx.assertEmail(email, "email is required");
|
||||
@@ -66,7 +66,7 @@ router.post("email", async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.get("email.callback", auth({ required: false }), async ctx => {
|
||||
router.get("email.callback", auth({ required: false }), async (ctx) => {
|
||||
const { token } = ctx.request.query;
|
||||
|
||||
ctx.assertPresent(token, "token is required");
|
||||
|
||||
@@ -18,7 +18,7 @@ const client = new OAuth2Client(
|
||||
const allowedDomainsEnv = process.env.GOOGLE_ALLOWED_DOMAINS;
|
||||
|
||||
// start the oauth process and redirect user to Google
|
||||
router.get("google", async ctx => {
|
||||
router.get("google", async (ctx) => {
|
||||
// Generate the url that will be used for the consent dialog.
|
||||
const authorizeUrl = client.generateAuthUrl({
|
||||
access_type: "offline",
|
||||
@@ -32,7 +32,7 @@ router.get("google", async ctx => {
|
||||
});
|
||||
|
||||
// signin callback from Google
|
||||
router.get("google.callback", auth({ required: false }), async ctx => {
|
||||
router.get("google.callback", auth({ required: false }), async (ctx) => {
|
||||
const { code } = ctx.request.query;
|
||||
ctx.assertPresent(code, "code is required");
|
||||
const response = await client.getToken(code);
|
||||
@@ -64,9 +64,7 @@ router.get("google.callback", auth({ required: false }), async ctx => {
|
||||
hash.update(googleId);
|
||||
const hashedGoogleId = hash.digest("hex");
|
||||
const cbUrl = `https://logo.clearbit.com/${profile.data.hd}`;
|
||||
const tileyUrl = `https://tiley.herokuapp.com/avatar/${hashedGoogleId}/${
|
||||
teamName[0]
|
||||
}.png`;
|
||||
const tileyUrl = `https://tiley.herokuapp.com/avatar/${hashedGoogleId}/${teamName[0]}.png`;
|
||||
const cbResponse = await fetch(cbUrl);
|
||||
const avatarUrl = cbResponse.status === 200 ? cbUrl : tileyUrl;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ router.use("/", slack.routes());
|
||||
router.use("/", google.routes());
|
||||
router.use("/", email.routes());
|
||||
|
||||
router.get("/redirect", auth(), async ctx => {
|
||||
router.get("/redirect", auth(), async (ctx) => {
|
||||
const user = ctx.state.user;
|
||||
|
||||
// transfer access token cookie from root to subdomain
|
||||
|
||||
@@ -19,10 +19,8 @@ const Op = Sequelize.Op;
|
||||
const router = new Router();
|
||||
|
||||
// start the oauth process and redirect user to Slack
|
||||
router.get("slack", async ctx => {
|
||||
const state = Math.random()
|
||||
.toString(36)
|
||||
.substring(7);
|
||||
router.get("slack", async (ctx) => {
|
||||
const state = Math.random().toString(36).substring(7);
|
||||
|
||||
ctx.cookies.set("state", state, {
|
||||
httpOnly: false,
|
||||
@@ -33,7 +31,7 @@ router.get("slack", async ctx => {
|
||||
});
|
||||
|
||||
// signin callback from Slack
|
||||
router.get("slack.callback", auth({ required: false }), async ctx => {
|
||||
router.get("slack.callback", auth({ required: false }), async (ctx) => {
|
||||
const { code, error, state } = ctx.request.query;
|
||||
ctx.assertPresent(code || error, "code is required");
|
||||
ctx.assertPresent(state, "state is required");
|
||||
@@ -142,7 +140,7 @@ router.get("slack.callback", auth({ required: false }), async ctx => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get("slack.commands", auth({ required: false }), async ctx => {
|
||||
router.get("slack.commands", auth({ required: false }), async (ctx) => {
|
||||
const { code, state, error } = ctx.request.query;
|
||||
const user = ctx.state.user;
|
||||
ctx.assertPresent(code || error, "code is required");
|
||||
@@ -194,7 +192,7 @@ router.get("slack.commands", auth({ required: false }), async ctx => {
|
||||
ctx.redirect("/settings/integrations/slack");
|
||||
});
|
||||
|
||||
router.get("slack.post", auth({ required: false }), async ctx => {
|
||||
router.get("slack.post", auth({ required: false }), async (ctx) => {
|
||||
const { code, error, state } = ctx.request.query;
|
||||
const user = ctx.state.user;
|
||||
ctx.assertPresent(code || error, "code is required");
|
||||
|
||||
Reference in New Issue
Block a user