mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-12 07:30:46 +02:00
6539e26107
[web] Join project page redesign GitOrigin-RevId: d182ec4fb744f384f824c9e63b534da02a9f8e99
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n'
|
|
import getMeta from '@/utils/meta'
|
|
import Invite from '@/features/share-project/invite'
|
|
import useAsync from '@/shared/hooks/use-async'
|
|
import { postJSON } from '@/infrastructure/fetch-json'
|
|
import { useLocation } from '@/shared/hooks/use-location'
|
|
import { debugConsole } from '@/utils/debugging'
|
|
|
|
export default function InviteRoot() {
|
|
const user = getMeta('ol-user')
|
|
const projectName = getMeta('ol-projectName')
|
|
const projectId = getMeta('ol-project_id')
|
|
const token = getMeta('ol-inviteToken')
|
|
const location = useLocation()
|
|
const { isLoading, runAsync } = useAsync()
|
|
const { isReady } = useWaitForI18n()
|
|
|
|
const handleSubmit = () => {
|
|
runAsync(postJSON(`/project/${projectId}/invite/token/${token}/accept`))
|
|
.then(() => location.assign(`/project/${projectId}`))
|
|
.catch(debugConsole.error)
|
|
}
|
|
|
|
if (!isReady) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Invite
|
|
projectName={projectName}
|
|
email={user.email}
|
|
submitHandler={handleSubmit}
|
|
isLoading={isLoading}
|
|
/>
|
|
)
|
|
}
|