wonderlandpark 2021-05-23 01:18:36 +09:00
parent eaedd77cfd
commit ddd39c8fac

View File

@ -17,6 +17,7 @@ import { ResponseProps, SubmittedBot, Theme, User } from '@types'
const CheckBox = dynamic(() => import('@components/Form/CheckBox')) const CheckBox = dynamic(() => import('@components/Form/CheckBox'))
const Label = dynamic(() => import('@components/Form/Label')) const Label = dynamic(() => import('@components/Form/Label'))
const Login = dynamic(() => import('@components/Login'))
const Input = dynamic(() => import('@components/Form/Input')) const Input = dynamic(() => import('@components/Form/Input'))
const Divider = dynamic(() => import('@components/Divider')) const Divider = dynamic(() => import('@components/Divider'))
const TextArea = dynamic(() => import('@components/Form/TextArea')) const TextArea = dynamic(() => import('@components/Form/TextArea'))
@ -58,6 +59,7 @@ const AddBot:NextPage<AddBotProps> = ({ logged, user, csrfToken, theme }) => {
_csrf: csrfToken, _csrf: csrfToken,
_captcha: 'captcha' _captcha: 'captcha'
} }
function toLogin() { function toLogin() {
localStorage.redirectTo = window.location.href localStorage.redirectTo = window.location.href
redirectTo(router, 'login') redirectTo(router, 'login')
@ -67,10 +69,10 @@ const AddBot:NextPage<AddBotProps> = ({ logged, user, csrfToken, theme }) => {
const res = await Fetch<SubmittedBot>(`/bots/${value.id}`, { method: 'POST', body: JSON.stringify(cleanObject<AddBotSubmit>({ ...value, _captcha: token})) }) const res = await Fetch<SubmittedBot>(`/bots/${value.id}`, { method: 'POST', body: JSON.stringify(cleanObject<AddBotSubmit>({ ...value, _captcha: token})) })
setData(res) setData(res)
} }
if(!logged) {
toLogin() if(!logged) return <Login>
return <NextSeo title='새로운 봇 추가하기' description='자신의 봇을 한국 디스코드봇 리스트에 등록하세요.' /> <NextSeo title='새로운 봇 추가하기' description='자신의 봇을 한국 디스코드봇 리스트에 등록하세요.' />
} </Login>
return <Container paddingTop className='py-5'> return <Container paddingTop className='py-5'>
<NextSeo title='새로운 봇 추가하기' description='자신의 봇을 한국 디스코드봇 리스트에 등록하세요.' /> <NextSeo title='새로운 봇 추가하기' description='자신의 봇을 한국 디스코드봇 리스트에 등록하세요.' />
<h1 className='text-3xl font-bold'> </h1> <h1 className='text-3xl font-bold'> </h1>