From ddd39c8fac0582f7e27fbcf80ee30ffd3ebc6e27 Mon Sep 17 00:00:00 2001 From: wonderlandpark Date: Sun, 23 May 2021 01:18:36 +0900 Subject: [PATCH] fix: https://github.com/koreanbots/v2-testing/issues/89 --- pages/addbot.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pages/addbot.tsx b/pages/addbot.tsx index 49294d2..b580514 100644 --- a/pages/addbot.tsx +++ b/pages/addbot.tsx @@ -17,6 +17,7 @@ import { ResponseProps, SubmittedBot, Theme, User } from '@types' const CheckBox = dynamic(() => import('@components/Form/CheckBox')) const Label = dynamic(() => import('@components/Form/Label')) +const Login = dynamic(() => import('@components/Login')) const Input = dynamic(() => import('@components/Form/Input')) const Divider = dynamic(() => import('@components/Divider')) const TextArea = dynamic(() => import('@components/Form/TextArea')) @@ -58,19 +59,20 @@ const AddBot:NextPage = ({ logged, user, csrfToken, theme }) => { _csrf: csrfToken, _captcha: 'captcha' } + function toLogin() { localStorage.redirectTo = window.location.href redirectTo(router, 'login') } - + async function submitBot(value: AddBotSubmit, token: string) { const res = await Fetch(`/bots/${value.id}`, { method: 'POST', body: JSON.stringify(cleanObject({ ...value, _captcha: token})) }) setData(res) } - if(!logged) { - toLogin() - return - } + + if(!logged) return + + return

새로운 봇 추가하기