mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
chore: made some changes at redirect
This commit is contained in:
parent
0ebb78b57c
commit
3f57eac291
@ -1,3 +1,4 @@
|
||||
import { ReactNode } from 'react'
|
||||
import dynamic from 'next/dynamic'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
@ -5,10 +6,13 @@ import { redirectTo } from '@utils/Tools'
|
||||
|
||||
const Container = dynamic(() => import('@components/Container'))
|
||||
|
||||
const Redirect = ({ to }:RedirectProps):JSX.Element => {
|
||||
const Redirect = ({ to, children }:RedirectProps):JSX.Element => {
|
||||
const router = useRouter()
|
||||
if(!to) throw new Error('No Link')
|
||||
redirectTo(router, to)
|
||||
if(children) return <>
|
||||
{children}
|
||||
</>
|
||||
return <Container paddingTop>
|
||||
<div>
|
||||
<a href={to} className='text-blue-400'>자동으로 리다이렉트되지 않는다면 클릭해세요.</a>
|
||||
@ -18,6 +22,7 @@ const Redirect = ({ to }:RedirectProps):JSX.Element => {
|
||||
|
||||
interface RedirectProps {
|
||||
to: string
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export default Redirect
|
||||
Loading…
x
Reference in New Issue
Block a user