[a26f6a1] | 1 | import React, {useEffect, useState} from 'react';
|
---|
| 2 | import {Header} from "../Header";
|
---|
| 3 | import {Button, Form, Input, Modal, notification, Spin} from "antd";
|
---|
| 4 | import axios from "axios";
|
---|
| 5 | import '../App.css'
|
---|
| 6 | import env from "../env";
|
---|
| 7 |
|
---|
| 8 | const SendReset = () => {
|
---|
| 9 |
|
---|
| 10 | const [loading, setLoading] = useState(false);
|
---|
| 11 |
|
---|
| 12 | const sendResetEmail = (data) => {
|
---|
| 13 | setLoading(true)
|
---|
| 14 | axios.post(env.api + "Users/reset?email="+data.email, {}).then(el => {
|
---|
| 15 | setLoading(false);
|
---|
| 16 | Modal.success({
|
---|
| 17 | title: 'Инструкции за ресетирање на вашата лозинка се испратени на вашиот мејл',
|
---|
| 18 | });
|
---|
| 19 | }).catch(er => {
|
---|
| 20 | setLoading(false);
|
---|
| 21 | Modal.error({
|
---|
| 22 | title: 'Се случи проблем',
|
---|
| 23 | });
|
---|
| 24 | console.log(er);
|
---|
| 25 | });
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | return (
|
---|
| 29 | <div>
|
---|
| 30 | <div style={{width:'100vw',height:'100vh', textAlign:'center',backgroundColor:'#F2F2F2'}}>
|
---|
| 31 | <div className='center' style={{backgroundColor:'white',padding:'40px', borderRadius:'20px'}}>
|
---|
| 32 | <h1 style={{marginBottom:'40px'}}>Ресетирајте ја вашата лозинка</h1>
|
---|
| 33 | <Form onFinish={sendResetEmail}
|
---|
| 34 | onFinishFailed={() => Modal.error({title: "Ве молиме пополнете ги задолжителните полиња"})}>
|
---|
| 35 | <Form.Item
|
---|
| 36 | label="Емаил"
|
---|
| 37 | name="email"
|
---|
| 38 | rules={[
|
---|
| 39 | {
|
---|
| 40 | required: true,
|
---|
| 41 | message: 'Ве молиме внесете емаил!',
|
---|
| 42 | },
|
---|
| 43 | ]}
|
---|
| 44 | >
|
---|
| 45 | <Input/>
|
---|
| 46 | </Form.Item>
|
---|
| 47 | <Form.Item>
|
---|
| 48 | <Button type="primary" htmlType="submit" loading={loading}>
|
---|
| 49 | Прати
|
---|
| 50 | </Button>
|
---|
| 51 | </Form.Item>
|
---|
| 52 | </Form>
|
---|
| 53 | </div>
|
---|
| 54 | </div>
|
---|
| 55 | </div>
|
---|
| 56 | )
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | export default SendReset; |
---|