-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: page view not corresponding to login state
- Loading branch information
Showing
31 changed files
with
427 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use client'; | ||
|
||
import { Button } from '@mantine/core'; | ||
import { ReactNode } from 'react'; | ||
|
||
const ErrorButton = ({ | ||
reset, | ||
errorMsg, | ||
navigate, | ||
}: { | ||
reset?: () => void; | ||
errorMsg: string | ReactNode; | ||
navigate?: () => void; | ||
}) => { | ||
return ( | ||
<Button | ||
variant='default' | ||
size='md' | ||
mt='xl' | ||
className='control' | ||
onClick={() => { | ||
if (reset) reset(); | ||
else if (navigate) navigate(); | ||
}} | ||
mr='lg' | ||
> | ||
{errorMsg} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default ErrorButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Box, Text } from '@mantine/core'; | ||
|
||
const AuthButton = ({ btnText, fn }: { btnText: string; fn: () => void }) => { | ||
return ( | ||
<Box mt='lg'> | ||
<Text className='hvr txt' onClick={fn} size='sm' ta='center'> | ||
{btnText} | ||
</Text> | ||
</Box> | ||
); | ||
}; | ||
export default AuthButton; |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...components/stories/LoginButton.stories.ts → .../components/stories/AuthButton.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
'use client'; | ||
import { signIn, useSession } from 'next-auth/react'; | ||
|
||
import ProfileSkeleton from '@/components/shared/ProfileSkeleton'; | ||
import { useEffect } from 'react'; | ||
|
||
import UserData from './components/Profile'; | ||
|
||
export default function DefaultInfo() { | ||
const { status } = useSession(); | ||
const { data: session, status } = useSession({ | ||
required: true, | ||
onUnauthenticated() { | ||
return signIn(); | ||
}, | ||
}); | ||
useEffect(() => { | ||
if (!session && status !== 'loading') { | ||
signIn(); | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
|
||
if (status === 'unauthenticated') { | ||
return signIn(); | ||
} | ||
if (status === 'loading') return <ProfileSkeleton />; | ||
if (status === 'authenticated') return <UserData />; | ||
return <UserData />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
'use client'; | ||
import { signIn, useSession } from 'next-auth/react'; | ||
|
||
import ProfileSkeleton from '@/components/shared/ProfileSkeleton'; | ||
import DefaultInfo from './default'; | ||
|
||
import UserData from './components/Profile'; | ||
|
||
export default function DefaultInfo() { | ||
const { status } = useSession(); | ||
if (status === 'unauthenticated') { | ||
return signIn(); | ||
} | ||
if (status === 'loading') return <ProfileSkeleton />; | ||
if (status === 'authenticated') return <UserData />; | ||
export default function MyInfo() { | ||
return <DefaultInfo />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
'use client'; | ||
import { signIn, useSession } from 'next-auth/react'; | ||
|
||
import MyRoadmapsTabs from '../Tabs'; | ||
|
||
export default function CreatedRoadmap() { | ||
const { status } = useSession(); | ||
if (status === 'unauthenticated') { | ||
signIn(); | ||
} | ||
// const { status } = useSession(); | ||
// if (status === 'unauthenticated') { | ||
// signIn(); | ||
// } | ||
return <MyRoadmapsTabs />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
'use client'; | ||
import { signIn, useSession } from 'next-auth/react'; | ||
|
||
import MyRoadmapsTabs from '../Tabs'; | ||
|
||
export default function InProgressRoadmap() { | ||
const { status } = useSession(); | ||
if (status === 'unauthenticated') { | ||
signIn(); | ||
} | ||
// const { status } = useSession(); | ||
// if (status === 'unauthenticated') { | ||
// signIn(); | ||
// } | ||
|
||
return <MyRoadmapsTabs />; | ||
} |
Oops, something went wrong.