gle
gle
TTCTheo's Typesafe Cult
Created by gle on 5/11/2023 in #questions
publicPages not working.
import type { AppProps } from "next/app";
import { ClerkProvider, SignedIn } from "@clerk/nextjs";
import { useRouter } from "next/router";
import SignUpPage from "./sign-up/[[...index]]";
import SignInPage from "./sign-in/[[...index]]";
import { api } from "~/utils/api";

import "../styles/globals.css";
import "../styles/App.css";

const publicPages = ['/contactUs']

function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter();

if (publicPages.includes(router.pathname)) {
return (
<main>
<Component {...pageProps} />
</main>
);
} else {
return (
<ClerkProvider theme={theme} {...pageProps}>
<main>
<SignedIn>
<Component {...pageProps} />
</SignedIn>
{router.pathname.match("/sign-up") ? <SignUpPage /> : <SignInPage />}
</main>
<footer>
</footer>
</ClerkProvider>
);
}
}

export default api.withTRPC(MyApp);
import type { AppProps } from "next/app";
import { ClerkProvider, SignedIn } from "@clerk/nextjs";
import { useRouter } from "next/router";
import SignUpPage from "./sign-up/[[...index]]";
import SignInPage from "./sign-in/[[...index]]";
import { api } from "~/utils/api";

import "../styles/globals.css";
import "../styles/App.css";

const publicPages = ['/contactUs']

function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter();

if (publicPages.includes(router.pathname)) {
return (
<main>
<Component {...pageProps} />
</main>
);
} else {
return (
<ClerkProvider theme={theme} {...pageProps}>
<main>
<SignedIn>
<Component {...pageProps} />
</SignedIn>
{router.pathname.match("/sign-up") ? <SignUpPage /> : <SignInPage />}
</main>
<footer>
</footer>
</ClerkProvider>
);
}
}

export default api.withTRPC(MyApp);
I have the correct path. but whenever I type in localhost:3000/contactUs it just redirects me to the sign up / log in page.
14 replies
TTCTheo's Typesafe Cult
Created by gle on 5/7/2023 in #questions
Background image not loading? Help #noob
4 replies
TTCTheo's Typesafe Cult
Created by gle on 5/7/2023 in #questions
Building your own UI using clerk & t3
1 replies