|
|
@ -1,6 +1,6 @@ |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
|
|
|
|
|
|
import { Form, Input, Button, Select } from 'antd'; |
|
|
|
|
|
|
|
|
import { Form, Input, Button, Select, notification } from 'antd'; |
|
|
|
|
|
|
|
|
import _service from '@netuno/service-client'; |
|
|
import _service from '@netuno/service-client'; |
|
|
|
|
|
|
|
|
@ -29,8 +29,27 @@ export default ()=> { |
|
|
}, []); |
|
|
}, []); |
|
|
|
|
|
|
|
|
const onFinish = (values) => { |
|
|
const onFinish = (values) => { |
|
|
|
|
|
|
|
|
console.log('Success:', values); |
|
|
console.log('Success:', values); |
|
|
|
|
|
_service({ |
|
|
|
|
|
method: 'POST', |
|
|
|
|
|
url: 'public/register', |
|
|
|
|
|
data: values, |
|
|
|
|
|
success: (response) => { |
|
|
|
|
|
if (response.result) { |
|
|
|
|
|
notification["success"]({ |
|
|
|
|
|
message: 'Registado', |
|
|
|
|
|
description: 'Foi registado com sucesso.', |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (e) => { |
|
|
|
|
|
console.error('Service Register Error', e); |
|
|
|
|
|
notification["error"]({ |
|
|
|
|
|
message: 'Não Registado', |
|
|
|
|
|
description: 'Não foi possível registar, tente mais tarde.', |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const onFinishFailed = (errorInfo) => { |
|
|
const onFinishFailed = (errorInfo) => { |
|
|
@ -60,6 +79,16 @@ export default ()=> { |
|
|
<Input /> |
|
|
<Input /> |
|
|
</Form.Item> |
|
|
</Form.Item> |
|
|
<Form.Item |
|
|
<Form.Item |
|
|
|
|
|
label="E-mail" |
|
|
|
|
|
name="email" |
|
|
|
|
|
rules={[ |
|
|
|
|
|
{ required: true, message: 'Por favor insira o seu e-mail.' }, |
|
|
|
|
|
{ type: 'email', message: 'E-mail inválido.' } |
|
|
|
|
|
]} |
|
|
|
|
|
> |
|
|
|
|
|
<Input /> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item |
|
|
label="Utilizador" |
|
|
label="Utilizador" |
|
|
name="username" |
|
|
name="username" |
|
|
rules={[ |
|
|
rules={[ |
|
|
@ -69,7 +98,6 @@ export default ()=> { |
|
|
> |
|
|
> |
|
|
<Input /> |
|
|
<Input /> |
|
|
</Form.Item> |
|
|
</Form.Item> |
|
|
|
|
|
|
|
|
<Form.Item |
|
|
<Form.Item |
|
|
label="Password" |
|
|
label="Password" |
|
|
name="password" |
|
|
name="password" |
|
|
@ -80,7 +108,7 @@ export default ()=> { |
|
|
|
|
|
|
|
|
<Form.Item |
|
|
<Form.Item |
|
|
label="Cidade" |
|
|
label="Cidade" |
|
|
name="city" |
|
|
|
|
|
|
|
|
name="city_uid" |
|
|
rules={[{ required: true, message: 'Por favor insira a sua cidade.' }]} |
|
|
rules={[{ required: true, message: 'Por favor insira a sua cidade.' }]} |
|
|
> |
|
|
> |
|
|
<Select allowClear> |
|
|
<Select allowClear> |
|
|
|