Skip to content

Commit

Permalink
Removes got usage from frontend in favor of fetch (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei authored Jul 17, 2024
1 parent fd4ad0d commit ed67e9c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 265 deletions.
9 changes: 6 additions & 3 deletions frontend/apps/web/app/api/webhooks/keycloak/slack/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createHmac, timingSafeEqual } from 'crypto';
import { format } from 'date-fns';
import { toZonedTime } from 'date-fns-tz';
import got from 'got';
import { NextRequest, NextResponse } from 'next/server';
import * as Yup from 'yup';
import { Block } from './block';
Expand Down Expand Up @@ -116,8 +115,12 @@ export async function POST(req: NextRequest): Promise<NextResponse> {

const registerEvent = await RegisterEvent.validate(JSON.parse(text));

await got.post(SLACK_WEBHOOK_URL, {
json: getSlackMessage(registerEvent),
await fetch(SLACK_WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(getSlackMessage(registerEvent)),
});

return NextResponse.json({ message: 'ok', contents: JSON.parse(text) });
Expand Down
1 change: 0 additions & 1 deletion frontend/apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"cron-validate": "^1.4.5",
"date-fns": "^3.6.0",
"date-fns-tz": "^3.1.3",
"got": "^14.4.1",
"monaco-editor": "^0.50.0",
"nanoid": "^5.0.7",
"next": "^14.2.5",
Expand Down
Loading

0 comments on commit ed67e9c

Please sign in to comment.