source: frontend/src/Auth/SendReset.js@ 63f5ced

Last change on this file since 63f5ced was a26f6a1, checked in by Danilo <danilo.najkov@…>, 2 years ago

full auth flow

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[a26f6a1]1import React, {useEffect, useState} from 'react';
2import {Header} from "../Header";
3import {Button, Form, Input, Modal, notification, Spin} from "antd";
4import axios from "axios";
5import '../App.css'
6import env from "../env";
7
8const 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
59export default SendReset;
Note: See TracBrowser for help on using the repository browser.