This repository has been archived by the owner on May 8, 2024. It is now read-only.
-
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.
- Loading branch information
Showing
3 changed files
with
138 additions
and
2 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
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,39 @@ | ||
import { useRequest } from 'ahooks' | ||
import PageContainer from 'components/PageContainer' | ||
import { useNavigate, useSearchParams } from 'react-router-dom' | ||
import Backend from 'utils/service' | ||
|
||
const Activate: React.FC = () => { | ||
const navigate = useNavigate() | ||
const [searchParams] = useSearchParams() | ||
const id = searchParams.get('id') ?? '' | ||
const code = searchParams.get('code') ?? '' | ||
const { loading } = useRequest( | ||
async () => | ||
Backend.auth.v1AuthActivateCreate({ | ||
id, | ||
code | ||
}), | ||
{ | ||
onSuccess: () => { | ||
navigate('/') | ||
}, | ||
onError: () => { | ||
navigate('/register') | ||
} | ||
} | ||
) | ||
return ( | ||
<div className='text-center'> | ||
<h1>{loading ? 'Loading' : 'Redirecting'}</h1> | ||
</div> | ||
) | ||
} | ||
|
||
const Index: React.FC = () => ( | ||
<PageContainer> | ||
<Activate /> | ||
</PageContainer> | ||
) | ||
|
||
export default Index |
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