use getSession() from @lib/auth everywhere (#563)

This commit is contained in:
Alex Johansson 2021-09-03 22:51:21 +02:00 committed by GitHub
parent 1cdb449ecc
commit 2f1ede9bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 37 additions and 27 deletions

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma from "../../../lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma from "../../../lib/prisma";
import { handleLegacyConfirmationMail } from "./[user]";
import { CalendarEvent } from "@lib/calendarClient";

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma from "../../../../lib/prisma";
import { symmetricEncrypt } from "@lib/crypto";
import logger from "@lib/logger";

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma from "../../../../lib/prisma";
const client_id = process.env.ZOOM_CLIENT_ID;

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {

View file

@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
import prisma from "../../lib/prisma";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import slugify from "@lib/slugify";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {

View file

@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
import prisma from "../../../../lib/prisma";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });

View file

@ -1,7 +1,7 @@
import type { NextApiRequest, NextApiResponse } from "next";
import prisma from "../../../../lib/prisma";
import createInvitationEmail from "../../../../lib/emails/invitation";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import { randomBytes } from "crypto";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {

View file

@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
import prisma from "../../../../lib/prisma";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });

View file

@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
import prisma from "@lib/prisma";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });

View file

@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
import prisma from "../../../lib/prisma";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });

View file

@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import prisma, { whereAndSelect } from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {

View file

@ -1,8 +1,9 @@
import { HeadSeo } from "@components/seo/head-seo";
import Link from "next/link";
import React from "react";
import { getCsrfToken, getSession } from "next-auth/client";
import { getCsrfToken } from "next-auth/client";
import debounce from "lodash.debounce";
import { getSession } from "@lib/auth";
export default function ForgotPassword({ csrfToken }) {
const [loading, setLoading] = React.useState(false);

View file

@ -1,6 +1,7 @@
import { HeadSeo } from "@components/seo/head-seo";
import Link from "next/link";
import { getCsrfToken, getSession } from "next-auth/client";
import { getCsrfToken } from "next-auth/client";
import { getSession } from "@lib/auth";
export default function Login({ csrfToken }) {
return (

View file

@ -4,9 +4,10 @@ import Modal from "@components/Modal";
import Shell from "@components/Shell";
import { useRouter } from "next/router";
import { useRef, useState } from "react";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import { ClockIcon } from "@heroicons/react/outline";
import Loader from "@components/Loader";
import { getSession } from "@lib/auth";
export default function Availability(props) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View file

@ -3,7 +3,7 @@ import prisma from "@lib/prisma";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import { GetServerSideProps } from "next";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import { useEffect, useState } from "react";
import Shell from "@components/Shell";

View file

@ -1,5 +1,5 @@
import prisma from "@lib/prisma";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import Shell from "@components/Shell";
import { useRouter } from "next/router";
import dayjs from "dayjs";
@ -9,6 +9,7 @@ import { DotsHorizontalIcon } from "@heroicons/react/solid";
import classNames from "@lib/classNames";
import { ClockIcon, XIcon } from "@heroicons/react/outline";
import Loader from "@components/Loader";
import { getSession } from "@lib/auth";
export default function Bookings({ bookings }) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View file

@ -7,7 +7,7 @@ import prisma from "@lib/prisma";
import { EventTypeCustomInput, EventTypeCustomInputType } from "@prisma/client";
import { LocationType } from "@lib/location";
import Shell from "@components/Shell";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import { Scheduler } from "@components/ui/Scheduler";
import { Disclosure, RadioGroup } from "@headlessui/react";
import { PhoneIcon, XIcon } from "@heroicons/react/outline";

View file

@ -15,7 +15,7 @@ import {
import classNames from "@lib/classNames";
import showToast from "@lib/notification";
import dayjs from "dayjs";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import Link from "next/link";
import { useRouter } from "next/router";
import React, { Fragment, useRef } from "react";
@ -25,6 +25,7 @@ import { GetServerSidePropsContext, InferGetServerSidePropsType } from "next";
import { useMutation } from "react-query";
import createEventType from "@lib/mutations/event-types/create-event-type";
import { ONBOARDING_INTRODUCED_AT } from "@lib/getting-started";
import { getSession } from "@lib/auth";
const EventTypesPage = (props: InferGetServerSidePropsType<typeof getServerSideProps>) => {
const { user, types } = props;

View file

@ -3,8 +3,9 @@ import { getIntegrationName, getIntegrationType } from "@lib/integrations";
import Shell from "@components/Shell";
import { useState } from "react";
import { useRouter } from "next/router";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import Loader from "@components/Loader";
import { getSession } from "@lib/auth";
export default function Integration(props) {
const router = useRouter();

View file

@ -2,7 +2,7 @@ import Link from "next/link";
import prisma from "@lib/prisma";
import Shell from "@components/Shell";
import { useEffect, useState, useRef, useCallback } from "react";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import { CheckCircleIcon, ChevronRightIcon, PlusIcon, XCircleIcon } from "@heroicons/react/solid";
import { InformationCircleIcon } from "@heroicons/react/outline";
import { Dialog, DialogClose, DialogContent, DialogHeader, DialogTrigger } from "@components/Dialog";
@ -11,6 +11,7 @@ import Loader from "@components/Loader";
import AddCalDavIntegration, {
ADD_CALDAV_INTEGRATION_FORM_TITLE,
} from "@lib/integrations/CalDav/components/AddCalDavIntegration";
import { getSession } from "@lib/auth";
export type Integration = {
installed: boolean;

View file

@ -1,7 +1,7 @@
import Shell from "@components/Shell";
import SettingsShell from "@components/Settings";
import prisma from "@lib/prisma";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
export default function Billing() {
return (

View file

@ -1,8 +1,9 @@
import prisma from "@lib/prisma";
import Shell from "@components/Shell";
import SettingsShell from "@components/Settings";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import Loader from "@components/Loader";
import { getSession } from "@lib/auth";
export default function Embed(props) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View file

@ -3,8 +3,9 @@ import prisma from "@lib/prisma";
import Modal from "@components/Modal";
import Shell from "@components/Shell";
import SettingsShell from "@components/Settings";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import Loader from "@components/Loader";
import { getSession } from "@lib/auth";
export default function Settings() {
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View file

@ -5,7 +5,7 @@ import Modal from "@components/Modal";
import Shell from "@components/Shell";
import SettingsShell from "@components/Settings";
import Avatar from "@components/Avatar";
import { getSession } from "next-auth/client";
import { getSession } from "@lib/auth";
import Select from "react-select";
import TimezoneSelect from "react-timezone-select";
import { UsernameInput } from "@components/ui/UsernameInput";

View file

@ -3,11 +3,12 @@ import Shell from "@components/Shell";
import SettingsShell from "@components/Settings";
import { useEffect, useState } from "react";
import type { Session } from "next-auth";
import { getSession, useSession } from "next-auth/client";
import { useSession } from "next-auth/client";
import { UsersIcon } from "@heroicons/react/outline";
import TeamList from "@components/team/TeamList";
import TeamListItem from "@components/team/TeamListItem";
import Loader from "@components/Loader";
import { getSession } from "@lib/auth";
export default function Teams() {
const [, loading] = useSession();