efficient-indigoE
Refine16mo ago
23 replies
efficient-indigo

Create Company

The image shows how my Create page looks, but it should not look like that
The Code: import React from 'react'
import { CompanyList } from './list'
import { Form, Input, Modal } from 'antd'
import { Create, useModalForm } from '@refinedev/antd'
import { useGo } from '@refinedev/core'
import { CREATE_COMPANY_MUTATION } from '@/graphql/mutations'



const create = () => {
const go = useGo();

const goToListPage = () => {
go({
to: { resource: 'companies', action: 'list' },
options: { keepQuery: true },
type: 'replace',
});
};

const { formProps, modalProps } = useModalForm({
action: 'create',
resource: 'companies',
redirect: false,
mutationMode: 'pessimistic',
onMutationSuccess: goToListPage,

meta: {
gqlMutation: CREATE_COMPANY_MUTATION,
},
});


return(
<CompanyList>
<Modal
{...modalProps}
mask = {true}
onCancel = {goToListPage}
title = "Erstelle ein neues Unternehmen"
width = {512}
>
<Form {...formProps} layout = "vertical">
<Form.Item
label = "Comany Name"
name = "name"
rules = {[{required:true}]}

>
<Input placeholder = "Please enter a Company Name" />

</Form.Item>
</Form>

</Modal>
</CompanyList>
)

}

export default Create
Screenshot_2024-10-02_at_15.09.21.png
Was this page helpful?