-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
71 additions
and
71 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
width: 100vw; | ||
grid-column: 1; | ||
grid-row: 1 / 2; | ||
z-index: var(--z-index-popup); | ||
} | ||
|
||
.body { | ||
|
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,32 @@ | ||
'use client'; | ||
import { useEffect } from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
import useApi from 'components/hooks/useApi'; | ||
import { setUser } from 'store/app'; | ||
import { removeClientAuthToken } from 'lib/client'; | ||
|
||
export function Logout() { | ||
const disabled = !!(process.env.disableLogin || process.env.cloudMode); | ||
const router = useRouter(); | ||
const { post } = useApi(); | ||
|
||
useEffect(() => { | ||
async function logout() { | ||
await post('/auth/logout'); | ||
} | ||
|
||
if (!disabled) { | ||
removeClientAuthToken(); | ||
|
||
logout(); | ||
|
||
router.push('/login'); | ||
|
||
return () => setUser(null); | ||
} | ||
}, [disabled, router, post]); | ||
|
||
return null; | ||
} | ||
|
||
export default Logout; |
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,34 +1,5 @@ | ||
'use client'; | ||
import { useEffect } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import useApi from 'components/hooks/useApi'; | ||
import { setUser } from 'store/app'; | ||
import { removeClientAuthToken } from 'lib/client'; | ||
import Logout from './Logout'; | ||
|
||
async function getDisabled() { | ||
return !!(process.env.DISABLE_LOGIN || process.env.CLOUD_MODE); | ||
} | ||
|
||
export default async function LogoutPage() { | ||
const disabled = await getDisabled(); | ||
const router = useRouter(); | ||
const { post } = useApi(); | ||
|
||
useEffect(() => { | ||
async function logout() { | ||
await post('/auth/logout'); | ||
} | ||
|
||
if (!disabled) { | ||
removeClientAuthToken(); | ||
|
||
logout(); | ||
|
||
router.push('/login'); | ||
|
||
return () => setUser(null); | ||
} | ||
}, [disabled, router, post]); | ||
|
||
return null; | ||
export default function () { | ||
return <Logout />; | ||
} |
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,13 @@ | ||
'use client'; | ||
import WebsiteDetails from 'app/(app)/websites/[id]/WebsiteDetails'; | ||
import useShareToken from 'components/hooks/useShareToken'; | ||
|
||
export default function ({ shareId }) { | ||
const shareToken = useShareToken(shareId); | ||
|
||
if (!shareToken) { | ||
return null; | ||
} | ||
|
||
return <WebsiteDetails websiteId={shareToken.websiteId} />; | ||
} |
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,17 +1,9 @@ | ||
import Page from 'components/layout/Page'; | ||
import WebsiteDetails from 'app/(app)/websites/[id]/WebsiteDetails'; | ||
import useShareToken from 'components/hooks/useShareToken'; | ||
import Share from './Share'; | ||
|
||
export default function SharePage({ params }) { | ||
const shareToken = useShareToken(params.id); | ||
|
||
if (!shareToken) { | ||
export default function ({ params: { id } }) { | ||
if (!id) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Page> | ||
<WebsiteDetails websiteId={shareToken.websiteId} /> | ||
</Page> | ||
); | ||
return <Share shareId={id} />; | ||
} |
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,4 +1,4 @@ | ||
:root { | ||
html body { | ||
--primary400: var(--blue800); | ||
--primary500: var(--blue900); | ||
--primary600: var(--blue1000); | ||
|
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