chore: removed id at schema

This commit is contained in:
wonderlandpark 2021-03-12 13:17:06 +09:00
parent ac414b25bc
commit ce28be2641
2 changed files with 5 additions and 8 deletions

View File

@ -16,7 +16,7 @@ import { checkBotFlag, checkUserFlag, formatNumber, parseCookie } from '@utils/T
import NotFound from '../../404'
import Footer from '@components/Footer'
import { Field, Form, Formik } from 'formik'
import { ReportBotSchema } from '@utils/Yup'
import { ReportSchema } from '@utils/Yup'
const Container = dynamic(() => import('@components/Container'))
const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar'))
@ -186,8 +186,7 @@ const Bots: NextPage<BotsProps> = ({ data, date, user, theme, setTheme }) => {
</a>
<Modal header={`${data.name}#${data.tag} 신고하기`} isOpen={reportModal} onClose={() => setReportModal(false)} full dark={theme === 'dark'}>
<Formik onSubmit={console.log} validationSchema={ReportBotSchema} initialValues={{
id: data.id,
<Formik onSubmit={console.log} validationSchema={ReportSchema} initialValues={{
category: null,
description: ''
}}>

View File

@ -195,16 +195,14 @@ export interface BotStatUpdate {
servers: number
}
export const ReportBotSchema: Yup.SchemaOf<ReportBot> = Yup.object({
export const ReportSchema: Yup.SchemaOf<Report> = Yup.object({
category: Yup.mixed().oneOf(reportCats, '신고 구분은 필수 항목입니다.').required('신고 구분은 필수 항목입니다.'),
description: Yup.string().min(100, '최소 100자여야합니다.').max(2000, '2000자 이하로 입력해주세요.').required('설명은 필수 항목입니다.'),
id: Yup.string().required()
description: Yup.string().min(100, '최소 100자여야합니다.').max(1500, '1500자 이하로 입력해주세요.').required('설명은 필수 항목입니다.')
})
interface ReportBot {
export interface Report {
category: string
description: string
id: string
}
export const ManageBotSchema = Yup.object({