mirror of
https://github.com/documenso/documenso.git
synced 2025-11-18 02:32:00 +10:00
login logout redirects, session, remove out of scope code
This commit is contained in:
@ -2,6 +2,7 @@ import "../styles/tailwind.css";
|
||||
import { ReactElement, ReactNode } from "react";
|
||||
import type { AppProps } from "next/app";
|
||||
import { NextPage } from "next";
|
||||
import { SessionProvider } from "next-auth/react";
|
||||
|
||||
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
|
||||
getLayout?: (page: ReactElement) => ReactNode;
|
||||
@ -11,7 +12,14 @@ type AppPropsWithLayout = AppProps & {
|
||||
Component: NextPageWithLayout;
|
||||
};
|
||||
|
||||
export default function App({ Component, pageProps }: AppPropsWithLayout) {
|
||||
export default function App({
|
||||
Component,
|
||||
pageProps: { session, ...pageProps },
|
||||
}: AppPropsWithLayout) {
|
||||
const getLayout = Component.getLayout || ((page: any) => page);
|
||||
return getLayout(<Component {...pageProps} />);
|
||||
return getLayout(
|
||||
<SessionProvider session={session}>
|
||||
<Component {...pageProps} />{" "}
|
||||
</SessionProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import GitHubProvider from "next-auth/providers/github";
|
||||
export default NextAuth({
|
||||
providers: [
|
||||
GitHubProvider({
|
||||
clientId: "",
|
||||
clientSecret: "",
|
||||
clientId: "df804870b0d11b0779cf",
|
||||
clientSecret: "7ef4bbc0957e48e4e6e59c5b5879b3d75d90acc5",
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
import { useSession } from "next-auth/react";
|
||||
import type { ReactElement } from "react";
|
||||
import Layout from "../components/layout";
|
||||
import Settings from "../components/settings";
|
||||
import type { NextPageWithLayout } from "./_app";
|
||||
import { SessionProvider } from "next-auth/react";
|
||||
|
||||
const DocumentsPage: NextPageWithLayout = () => {
|
||||
const { data: session } = useSession();
|
||||
|
||||
console.log("Session:" + JSON.stringify(session));
|
||||
|
||||
const TeamPage: NextPageWithLayout = () => {
|
||||
return <>This is the documents page</>;
|
||||
};
|
||||
|
||||
TeamPage.getLayout = function getLayout(page: ReactElement) {
|
||||
DocumentsPage.getLayout = function getLayout(page: ReactElement) {
|
||||
return <Layout>{page}</Layout>;
|
||||
};
|
||||
|
||||
export default TeamPage;
|
||||
export default DocumentsPage;
|
||||
|
||||
Reference in New Issue
Block a user