Last change
on this file since d86edb7 was a26f6a1, checked in by Danilo <danilo.najkov@…>, 2 years ago |
full auth flow
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[a26f6a1] | 1 | import React, {useEffect} from 'react';
|
---|
| 2 | import {Header} from "../Header";
|
---|
| 3 | import {Button, Spin} from "antd";
|
---|
| 4 | import axios from "axios";
|
---|
| 5 | import env from "../env";
|
---|
| 6 |
|
---|
| 7 | const SendConfirm = ({setUser, user}) => {
|
---|
| 8 | const logout = () => {
|
---|
| 9 | localStorage.removeItem('Auth');
|
---|
| 10 | setUser(false)
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | const sendConfirmationEmail = () => {
|
---|
| 14 | axios.post(env.api + "Users/confirm", {}, {headers: {Authorization: localStorage.getItem('Auth')}}).then(el => {
|
---|
| 15 | console.log("sent")
|
---|
| 16 | }).catch(er => {
|
---|
| 17 | console.log(er);
|
---|
| 18 | });
|
---|
| 19 | }
|
---|
| 20 | useEffect(()=>{
|
---|
| 21 | console.log("once")
|
---|
| 22 | if(user && !user.isConfirmed) {
|
---|
| 23 | sendConfirmationEmail()
|
---|
| 24 | }
|
---|
| 25 | },[])
|
---|
| 26 |
|
---|
| 27 | return (
|
---|
| 28 | <div>
|
---|
| 29 | <Header onClickButton={() => logout()} buttonText={'Одјави се'}/>
|
---|
| 30 | {!user.isConfirmed ?
|
---|
| 31 | <div style={{textAlign:'center',margin:'50px'}}>
|
---|
| 32 | <h2>За да го користите овој вебсајт потребно е да го потврдите вашиот профил. Мејл за потврда на вашиот профил е пратен на вашата емаил адреса.</h2>
|
---|
| 33 | <Button type='primary' onClick={sendConfirmationEmail}>
|
---|
| 34 | Прати повторно
|
---|
| 35 | </Button>
|
---|
| 36 | </div>
|
---|
| 37 | :
|
---|
| 38 | <div style={{textAlign:'center',margin:'50px'}}>
|
---|
| 39 | <h2>Вашиот емаил е веќе потврден.</h2>
|
---|
| 40 | </div>
|
---|
| 41 | }
|
---|
| 42 | </div>
|
---|
| 43 | )
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | export default SendConfirm; |
---|
Note:
See
TracBrowser
for help on using the repository browser.