chore: better Prettier config for easier reviews
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
import { useRouter } from 'next/router'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
import { Form, useForm } from 'react-component-form'
|
||||
import type { HandleUseFormCallback } from 'react-component-form'
|
||||
import { useRouter } from "next/router"
|
||||
import useTranslation from "next-translate/useTranslation"
|
||||
import { Form, useForm } from "react-component-form"
|
||||
import type { HandleUseFormCallback } from "react-component-form"
|
||||
|
||||
import { useAuthentication } from '../../../tools/authentication'
|
||||
import { Input } from '../../design/Input'
|
||||
import { Main } from '../../design/Main'
|
||||
import { Button } from '../../design/Button'
|
||||
import { FormState } from '../../design/FormState'
|
||||
import type { Channel } from '../../../models/Channel'
|
||||
import { channelSchema } from '../../../models/Channel'
|
||||
import { useGuildMember } from '../../../contexts/GuildMember'
|
||||
import { useFormTranslation } from '../../../hooks/useFormTranslation'
|
||||
import { useAuthentication } from "../../../tools/authentication"
|
||||
import { Input } from "../../design/Input"
|
||||
import { Main } from "../../design/Main"
|
||||
import { Button } from "../../design/Button"
|
||||
import { FormState } from "../../design/FormState"
|
||||
import type { Channel } from "../../../models/Channel"
|
||||
import { channelSchema } from "../../../models/Channel"
|
||||
import { useGuildMember } from "../../../contexts/GuildMember"
|
||||
import { useFormTranslation } from "../../../hooks/useFormTranslation"
|
||||
|
||||
const schema = {
|
||||
name: channelSchema.name
|
||||
name: channelSchema.name,
|
||||
}
|
||||
|
||||
export const CreateChannel: React.FC = () => {
|
||||
@ -31,38 +31,38 @@ export const CreateChannel: React.FC = () => {
|
||||
try {
|
||||
const { data: channel } = await authentication.api.post<Channel>(
|
||||
`/guilds/${guild.id}/channels`,
|
||||
formData
|
||||
formData,
|
||||
)
|
||||
await router.push(`/application/${guild.id}/${channel.id}`)
|
||||
return null
|
||||
} catch (error) {
|
||||
return {
|
||||
type: 'error',
|
||||
message: 'errors:server-error'
|
||||
type: "error",
|
||||
message: "errors:server-error",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Main>
|
||||
<Form className='w-4/6 max-w-xs' onSubmit={handleUseForm(onSubmit)}>
|
||||
<Form className="w-4/6 max-w-xs" onSubmit={handleUseForm(onSubmit)}>
|
||||
<Input
|
||||
type='text'
|
||||
placeholder={t('common:name')}
|
||||
name='name'
|
||||
label={t('common:name')}
|
||||
type="text"
|
||||
placeholder={t("common:name")}
|
||||
name="name"
|
||||
label={t("common:name")}
|
||||
error={getFirstErrorTranslation(errors.name)}
|
||||
data-cy='channel-name-input'
|
||||
data-cy="channel-name-input"
|
||||
/>
|
||||
<Button
|
||||
className='mt-6 w-full'
|
||||
type='submit'
|
||||
data-cy='button-create-channel'
|
||||
className="mt-6 w-full"
|
||||
type="submit"
|
||||
data-cy="button-create-channel"
|
||||
>
|
||||
{t('application:create')}
|
||||
{t("application:create")}
|
||||
</Button>
|
||||
</Form>
|
||||
<FormState id='message' state={fetchState} message={message} />
|
||||
<FormState id="message" state={fetchState} message={message} />
|
||||
</Main>
|
||||
)
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export * from './CreateChannel'
|
||||
export * from "./CreateChannel"
|
||||
|
Reference in New Issue
Block a user