Enables strict mode in nextjs apps (#2354)

- We need this so zod works correctly

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Omar LópezandPeer Richelsen authored and GitHub committed 2022-04-04 20:26:14 +00:00
1 parent 4ff21deb89
commit a7f5250b4a
25 files changed
+178 -68

No files matched your search

@@ -1,14 +1,14 @@
import { useMutation } from "react-query";
import type { IntegrationOAuthCallbackState } from "@calcom/app-store/types";
import { NEXT_PUBLIC_BASE_URL } from "@calcom/lib/constants";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { App } from "@calcom/types/App";
function useAddAppMutation(type: App["type"], options?: Parameters<typeof useMutation>[2]) {
const appName = type.replace("_", "");
const mutation = useMutation(async () => {
const state: IntegrationOAuthCallbackState = {
returnTo: NEXT_PUBLIC_BASE_URL + location.pathname + location.search,
returnTo: WEBAPP_URL + "/apps/installed" + location.search,
};
const stateStr = encodeURIComponent(JSON.stringify(state));
const searchParams = `?state=${stateStr}`;
@@ -7,7 +7,7 @@
"description": "Apple calendar runs both the macOS and iOS mobile operating systems. Offering online cloud backup of calendars using Apple’s iCloud service, it can sync with Google Calendar and Microsoft Exchange Server. Users can schedule events in their day that include time, location, duration, and extra notes.",
"dependencies": {
"@calcom/prisma": "*",
"react-hook-form": "^7.20.4"
"react-hook-form": "^7.29.0"
},
"devDependencies": {
"@calcom/types": "*"
@@ -10,7 +10,7 @@
"@calcom/lib": "*",
"@calcom/prisma": "*",
"@calcom/ui": "*",
"react-hook-form": "^7.20.4"
"react-hook-form": "^7.29.0"
},
"devDependencies": {
"@calcom/types": "*"
+2 -2
View File
@@ -1,7 +1,7 @@
import { google } from "googleapis";
import type { NextApiRequest, NextApiResponse } from "next";
import { BASE_URL } from "@calcom/lib/constants";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { encodeOAuthState } from "../../_utils/encodeOAuthState";
@@ -15,7 +15,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
if (req.method === "GET") {
// Get token from Google Calendar API
const { client_secret, client_id } = JSON.parse(credentials).web;
const redirect_uri = BASE_URL + "/api/integrations/googlecalendar/callback";
const redirect_uri = WEBAPP_URL + "/api/integrations/googlecalendar/callback";
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uri);
const authUrl = oAuth2Client.generateAuthUrl({
@@ -1,7 +1,7 @@
import { google } from "googleapis";
import type { NextApiRequest, NextApiResponse } from "next";
import { BASE_URL } from "@calcom/lib/constants";
import { WEBAPP_URL } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
import { decodeOAuthState } from "../../_utils/decodeOAuthState";
@@ -21,7 +21,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
const { client_secret, client_id } = JSON.parse(credentials).web;
const redirect_uri = BASE_URL + "/api/integrations/googlecalendar/callback";
const redirect_uri = WEBAPP_URL + "/api/integrations/googlecalendar/callback";
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uri);
+7
View File
@@ -0,0 +1,7 @@
/**
* A correctly typed version of Object.Keys
* @url https://twitter.com/mpocock1/status/1502264005251018754
*/
export const objectKeys = <Obj extends object>(obj: Obj) => Object.keys(obj) as (keyof Obj)[];
export default objectKeys;
+2 -1
View File
@@ -3,11 +3,12 @@
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"declaration": false,
"declarationMap": false,
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,