Skip to content

Commit 85be4ae

Browse files
committed
gitignore
1 parent 0d52576 commit 85be4ae

File tree

4 files changed

+45
-7
lines changed

4 files changed

+45
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# .env file
22
.env
3-
3+
.gitignore
44
# dependencies
55
/node_modules
66
/.pnp

.husky/_/husky.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env sh
2+
if [ -z "$husky_skip_init" ]; then
3+
debug () {
4+
if [ "$HUSKY_DEBUG" = "1" ]; then
5+
echo "husky (debug) - $1"
6+
fi
7+
}
8+
9+
readonly hook_name="$(basename -- "$0")"
10+
debug "starting $hook_name..."
11+
12+
if [ "$HUSKY" = "0" ]; then
13+
debug "HUSKY env variable is set to 0, skipping hook"
14+
exit 0
15+
fi
16+
17+
if [ -f ~/.huskyrc ]; then
18+
debug "sourcing ~/.huskyrc"
19+
. ~/.huskyrc
20+
fi
21+
22+
readonly husky_skip_init=1
23+
export husky_skip_init
24+
sh -e "$0" "$@"
25+
exitCode="$?"
26+
27+
if [ $exitCode != 0 ]; then
28+
echo "husky - $hook_name hook exited with code $exitCode (error)"
29+
fi
30+
31+
if [ $exitCode = 127 ]; then
32+
echo "husky - command not found in PATH=$PATH"
33+
fi
34+
35+
exit $exitCode
36+
fi

lib/auth/WithAuth.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { useSession, signIn } from 'next-auth/react';
22
import { useLayoutEffect } from 'react';
33
import router from 'next/router';
4+
import { AuthenticatedPage } from '@lib/types';
45

56
type WithAuthProps = {
67
children: React.ReactNode;
7-
options?: {
8-
redirectTo?: string;
9-
};
8+
options?: AuthenticatedPage;
109
};
1110

1211
const WithAuth = ({ children, options }: WithAuthProps) => {

pages/_app.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ const queryClient = new QueryClient();
1313
const MyApp = ({ Component, pageProps }: ExtendedAppProps) => {
1414
const AnyComponent = Component as any;
1515
const content = Component.auth ? (
16-
<WithAuth options={Component.auth}>
17-
<AnyComponent {...pageProps} />
18-
</WithAuth>
16+
<>
17+
{/* @ts-expect-error Server Component */}
18+
<WithAuth options={Component.auth}>
19+
<AnyComponent {...pageProps} />
20+
</WithAuth>
21+
</>
1922
) : (
2023
<AnyComponent {...pageProps} />
2124
);

0 commit comments

Comments
 (0)