|
1 | 1 | import * as Yup from 'yup' |
2 | 2 | import YupKorean from 'yup-locales-ko' |
3 | 3 | import { ListType } from '@types' |
4 | | -import { botCategories, library, reportCats, serverCategories } from '@utils/Constants' |
| 4 | +import { botCategories, library, reportCats, reservedVanityBypass, serverCategories } from '@utils/Constants' |
5 | 5 | import { HTTPProtocol, ID, Prefix, reservedVanity, Url, Vanity } from '@utils/Regex' |
6 | 6 |
|
7 | 7 | Yup.setLocale(YupKorean) |
@@ -297,10 +297,14 @@ export const ManageBotSchema: Yup.SchemaOf<ManageBot> = Yup.object({ |
297 | 297 | .max(1500, '봇 설명은 최대 1500자여야합니다.') |
298 | 298 | .required('봇 설명은 필수 항목입니다.'), |
299 | 299 | vanity: Yup.string() |
300 | | - .min(3, '커스텀 URL은 최소 3자여야합니다.') |
301 | | - .max(32, '커스텀 URL은 최대 32자여야합니다.') |
302 | 300 | .matches(Vanity, '커스텀 URL은 영문만 포함할 수 있습니다.') |
303 | | - .matches(reservedVanity, '사용할 수 없는 커스텀 URL입니다.') |
| 301 | + .when('id', { |
| 302 | + is: (id: string) => reservedVanityBypass.includes(id), |
| 303 | + then: Yup.string(), |
| 304 | + otherwise: Yup.string().matches(reservedVanity, '예약어가 포함되었거나 사용할 수 없는 커스텀 URL입니다.') |
| 305 | + }) |
| 306 | + .min(2, '커스텀 URL은 최소 2자여야합니다.') |
| 307 | + .max(32, '커스텀 URL은 최대 32자여야합니다.') |
304 | 308 | .nullable(), |
305 | 309 | banner: Yup.string() |
306 | 310 | .matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.') |
|
0 commit comments