diff --git a/src/Redux/proxy.js b/src/Redux/proxy.js index 848c53c..f5edec1 100644 --- a/src/Redux/proxy.js +++ b/src/Redux/proxy.js @@ -31,7 +31,7 @@ class Proxy { if (await this.refresh()) return this.result(url, (await fetch()).data.data); break; default: - toast(response.data.message); + toast.error(response.data.message); } return false; }; diff --git a/src/views/Auth/Auth.js b/src/views/Auth/Auth.js index 124d1b9..e3e9c70 100644 --- a/src/views/Auth/Auth.js +++ b/src/views/Auth/Auth.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; - +import {ToastContainer} from 'react-toastify'; import Logo from './Logo/Logo'; import Bio from './Bio/Bio'; import Login from './Login/Login'; diff --git a/src/views/Auth/Login/Code/Code.js b/src/views/Auth/Login/Code/Code.js index b7796e9..dd19579 100644 --- a/src/views/Auth/Login/Code/Code.js +++ b/src/views/Auth/Login/Code/Code.js @@ -6,10 +6,6 @@ export default class Code extends Component { super(props); this.state = { - auth_code1: '', - auth_code2: '', - auth_code3: '', - auth_code4: '', flag: false, resendStatus: false, }; @@ -23,19 +19,21 @@ export default class Code extends Component { changeValue = (e) => { if (e.target.value.match('^[0-9]{1}$')) { - this.setState({ - [e.target.name]: e.target.value, - }); - if (e.target.name === 'auth_code1') { - this.setState({ o1: e.target.value }); + if (e.target.name === 'o1') { + if(typeof this.state.o1 === Number){ + console.log(e.target.value); + }else{ + this.setState({ o1 : e.target.value }); + } this.inputRef2.focus(); - } else if (e.target.name === 'auth_code2') { + } else if (e.target.name === 'o2') { this.setState({ o2: e.target.value }); this.inputRef3.focus(); - } else if (e.target.name === 'auth_code3') { + } else if (e.target.name === 'o3') { this.setState({ o3: e.target.value }); this.inputRef4.focus(); - } else if (e.target.name === 'auth_code4') { + } else if (e.target.name === 'o4') { + this.setState({ o4: e.target.value }); const o4 = e.target.value; const { o1, o2, o3 } = this.state; this.props.parent.setState({ otp: `${o1}${o2}${o3}${o4}` }); @@ -51,15 +49,15 @@ export default class Code extends Component { this.setState({ [e.target.name]: '', }); - if (e.target.name === 'auth_code1') { + if (e.target.name === 'o1') { return; - } else if (e.target.name === 'auth_code2') { + } else if (e.target.name === 'o2') { this.inputRef1.focus(); return; - } else if (e.target.name === 'auth_code3') { + } else if (e.target.name === 'o3') { this.inputRef2.focus(); return; - } else if (e.target.name === 'auth_code4') { + } else if (e.target.name === 'o4') { this.inputRef3.focus(); return; } @@ -70,6 +68,17 @@ export default class Code extends Component { this.inputRef1.focus(); } + onInput= (e) => { + e.target.value = e.target.value + .replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (c) { + return c.charCodeAt(0) & 0xf; + }) + .replace(/[^\d]/, '') + .slice(-1); + + + } + render() { return ( <> @@ -79,55 +88,63 @@ export default class Code extends Component {