|
|
|
@ -0,0 +1,58 @@ |
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
import { Form, Input, Select, Button, notification } from 'antd'; |
|
|
|
import _service from "@netuno/service-client"; |
|
|
|
import "./index.less" |
|
|
|
|
|
|
|
const layout = { |
|
|
|
labelCol: { |
|
|
|
span: 24, |
|
|
|
}, |
|
|
|
wrapperCol: { |
|
|
|
span: 24, |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
function NewPublication(){ |
|
|
|
const [communities, setCommunities] = useState([]) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
_service({ |
|
|
|
url:"api/communities", |
|
|
|
method: "GET", |
|
|
|
success: (response) => { |
|
|
|
setCommunities(response.json); |
|
|
|
}, |
|
|
|
fail: () => { |
|
|
|
notification.error({ |
|
|
|
message: "Erro to load communities" |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
|
|
|
|
console.log(communities) |
|
|
|
|
|
|
|
return( |
|
|
|
<> |
|
|
|
<Form {...layout} name="nest-messages" layout="vertical"> |
|
|
|
<Form.Item name="message" label="Nova publicação"> |
|
|
|
<Input.TextArea /> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item name="community"> |
|
|
|
<Select placeholder="Selecione uma comunidade"> |
|
|
|
{communities.map(community => { |
|
|
|
<Select.Option value={community.uid}>{community.nome}sdsd</Select.Option> |
|
|
|
})} |
|
|
|
</Select> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item wrapperCol={{ ...layout.wrapperCol, offset: 0 }}> |
|
|
|
<Button type="primary" htmlType="submit"> |
|
|
|
Publicar |
|
|
|
</Button> |
|
|
|
</Form.Item> |
|
|
|
</Form> |
|
|
|
</> |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
export default NewPublication |