namirasoft-account-react 1.4.290 → 1.4.291
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import { IBaseComponentProps, NSRouterMakerProps } from 'namirasoft-site-react';
|
|
3
3
|
import { NSARouterMakerProps } from '../NSARouterMakerProps';
|
|
4
|
-
export interface
|
|
4
|
+
export interface NSAVerificationPageProps extends IBaseComponentProps, NSRouterMakerProps, NSARouterMakerProps {
|
|
5
5
|
contact_type: string;
|
|
6
6
|
contact_value_name: string;
|
|
7
7
|
getContactValue: (checkErrors: boolean) => string;
|
|
@@ -13,4 +13,12 @@ export interface INSAVerificationPageProps extends IBaseComponentProps, NSRouter
|
|
|
13
13
|
export interface NSAVerificationPageState {
|
|
14
14
|
isSendCode: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
16
|
+
export declare class NSAVerificationPage extends React.Component<NSAVerificationPageProps, NSAVerificationPageState> {
|
|
17
|
+
private NSButtonBlue_Verify;
|
|
18
|
+
private NSBoxString_Code;
|
|
19
|
+
constructor(props: NSAVerificationPageProps);
|
|
20
|
+
private onRequest;
|
|
21
|
+
private onVerify;
|
|
22
|
+
componentDidMount(): void;
|
|
23
|
+
render(): ReactNode;
|
|
24
|
+
}
|
|
@@ -8,75 +8,83 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
11
|
+
import React, { createRef } from "react";
|
|
12
12
|
import { NSBoxString } from 'namirasoft-site-react';
|
|
13
13
|
import { NSSection, NSSpace, NSSpaceSizeType, NSButtonBlue } from 'namirasoft-site-react';
|
|
14
14
|
import Styles from './NSAVerificationPage.module.css';
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(_a = NSButtonBlue_Verify.current) === null || _a === void 0 ? void 0 : _a.performClick();
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}, [code, NSButtonBlue_Verify.current]);
|
|
29
|
-
const [state, setState] = useState({
|
|
30
|
-
isSendCode: code.length > 0
|
|
31
|
-
});
|
|
32
|
-
function onRequest(onFinshied) {
|
|
15
|
+
export class NSAVerificationPage extends React.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.NSButtonBlue_Verify = createRef();
|
|
19
|
+
this.NSBoxString_Code = createRef();
|
|
20
|
+
this.state = { isSendCode: false };
|
|
21
|
+
this.onRequest = this.onRequest.bind(this);
|
|
22
|
+
this.onVerify = this.onVerify.bind(this);
|
|
23
|
+
}
|
|
24
|
+
onRequest(onFinshied) {
|
|
33
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
26
|
try {
|
|
35
|
-
props.onRequest(props.getContactValue(true)).then(() => {
|
|
36
|
-
setState(
|
|
37
|
-
props.notifier.onSuccess(`Verification code has been sent successfully.`);
|
|
27
|
+
this.props.onRequest(this.props.getContactValue(true)).then(() => {
|
|
28
|
+
this.setState({ isSendCode: true });
|
|
29
|
+
this.props.notifier.onSuccess(`Verification code has been sent successfully.`);
|
|
38
30
|
onFinshied();
|
|
39
31
|
}).catch(onFinshied);
|
|
40
32
|
}
|
|
41
33
|
catch (error) {
|
|
42
|
-
props.notifier.onError(error);
|
|
34
|
+
this.props.notifier.onError(error);
|
|
43
35
|
}
|
|
44
36
|
});
|
|
45
37
|
}
|
|
46
|
-
|
|
38
|
+
onVerify(onFinshied) {
|
|
47
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
40
|
var _a, _b;
|
|
49
41
|
try {
|
|
50
|
-
let code = (_b = (_a = NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.getValue()) !== null && _b !== void 0 ? _b : "";
|
|
51
|
-
props.onVerify(code).then(() => {
|
|
52
|
-
props.notifier.onSuccess("Verification has been done successfully.");
|
|
53
|
-
props.notifier.onSuccess("Redirecting ...", 2000);
|
|
42
|
+
let code = (_b = (_a = this.NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.getValue()) !== null && _b !== void 0 ? _b : "";
|
|
43
|
+
this.props.onVerify(code).then(() => {
|
|
44
|
+
this.props.notifier.onSuccess("Verification has been done successfully.");
|
|
45
|
+
this.props.notifier.onSuccess("Redirecting ...", 2000);
|
|
54
46
|
setTimeout(() => {
|
|
55
|
-
props.onFinished();
|
|
47
|
+
this.props.onFinished();
|
|
56
48
|
onFinshied();
|
|
57
49
|
}, 2000);
|
|
58
50
|
}).catch(onFinshied);
|
|
59
51
|
}
|
|
60
52
|
catch (error) {
|
|
61
|
-
props.notifier.onError(error);
|
|
53
|
+
this.props.notifier.onError(error);
|
|
62
54
|
}
|
|
63
55
|
});
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
var _a;
|
|
59
|
+
let code = (_a = this.props.url.getQuery("code")) !== null && _a !== void 0 ? _a : "";
|
|
60
|
+
if (code) {
|
|
61
|
+
this.setState({ isSendCode: true }, () => {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = this.NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.setValue(code, () => {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = this.NSButtonBlue_Verify.current) === null || _a === void 0 ? void 0 : _a.performClick();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return (_jsx(_Fragment, { children: _jsxs(NSSection, { children: [_jsxs("div", { className: `${Styles.nsa_verification_container} ${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: this.props.style, children: [_jsx("img", { src: "https://static.namirasoft.com/image/concept/verification/purple.png", alt: 'verification vector', className: Styles.nsa_verification_vector }), _jsxs("div", { className: 'm-0', children: [_jsxs("p", { className: 'm-2', children: ["Type: ", this.props.contact_type] }), ((this.state.isSendCode || !this.props.children) && this.props.getContactValue(false)) &&
|
|
73
|
+
_jsxs("p", { className: 'm-2', children: [this.props.contact_value_name, ": ", this.props.getContactValue(false)] }), this.props.children &&
|
|
74
|
+
_jsx("div", { style: { display: this.state.isSendCode ? "none" : undefined }, children: this.props.children })] }), this.state.isSendCode ?
|
|
75
|
+
_jsxs(_Fragment, { children: [_jsx("p", { style: { margin: "0px" }, children: "Please enter the code you received" }), _jsx(NSBoxString, { ref: this.NSBoxString_Code, title: 'Verification Code', placeholder: 'Enter the code', hideHeader: true, required: true, min_length: 6, max_length: 6, input: { style: { fontSize: '24px', fontWeight: "bold", textAlign: "center" } } })] }) :
|
|
76
|
+
_jsx(_Fragment, { children: _jsx(NSButtonBlue, { ref: this.NSButtonBlue_Verify, title: 'Send Code', onClick: {
|
|
77
|
+
action: (onFinished) => {
|
|
78
|
+
this.onRequest(onFinished);
|
|
79
|
+
},
|
|
80
|
+
} }) })] }), _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), this.state.isSendCode &&
|
|
81
|
+
_jsxs(_Fragment, { children: [_jsx(NSButtonBlue, { title: "Verify", onClick: {
|
|
70
82
|
action: (onFinished) => {
|
|
71
|
-
|
|
83
|
+
this.onVerify(onFinished);
|
|
72
84
|
},
|
|
73
|
-
} })
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
} }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("button", { onClick: () => {
|
|
79
|
-
setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: false })));
|
|
80
|
-
}, className: Styles.nsa_resend_button, children: "Resend Code" })] })] }) }));
|
|
85
|
+
} }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("button", { onClick: () => {
|
|
86
|
+
this.setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: false })));
|
|
87
|
+
}, className: Styles.nsa_resend_button, children: "Resend Code" })] })] }) }));
|
|
88
|
+
}
|
|
81
89
|
}
|
|
82
90
|
//# sourceMappingURL=NSAVerificationPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSAVerificationPage.js","sourceRoot":"","sources":["../../src/pages/NSAVerificationPage.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"NSAVerificationPage.js","sourceRoot":"","sources":["../../src/pages/NSAVerificationPage.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AACpD,OAAO,EAA2C,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,MAAM,MAAM,kCAAkC,CAAC;AAkBtD,MAAM,OAAO,mBAAoB,SAAQ,KAAK,CAAC,SAA6D;IAI3G,YAAY,KAA+B;QAE1C,KAAK,CAAC,KAAK,CAAC,CAAC;QAJN,wBAAmB,GAAG,SAAS,EAAgB,CAAC;QAChD,qBAAgB,GAAG,SAAS,EAAe,CAAC;QAInD,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC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3B,CAAC;qCACD,GACA,EACF,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,KAAK,GAAY,EAChD,iBAAQ,OAAO,EAAE,GAAG,EAAE;wCAErB,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,iCAAM,SAAS,KAAE,UAAU,EAAE,KAAK,IAAG,CAAC,CAAA;oCAClE,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,4BAAsB,IAC1D,IAEQ,GACX,CACH,CAAC;IACH,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { createRef, ReactNode } from "react";
|
|
2
2
|
import { IBaseComponentProps, NSRouterMakerProps, NSBoxString } from 'namirasoft-site-react';
|
|
3
3
|
import { NSSection, NSSpace, NSSpaceSizeType, NSButtonBlue } from 'namirasoft-site-react';
|
|
4
4
|
import { NSARouterMakerProps } from '../NSARouterMakerProps';
|
|
5
5
|
import Styles from './NSAVerificationPage.module.css';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface NSAVerificationPageProps extends IBaseComponentProps, NSRouterMakerProps, NSARouterMakerProps
|
|
8
8
|
{
|
|
9
9
|
contact_type: string;
|
|
10
10
|
contact_value_name: string;
|
|
@@ -20,142 +20,146 @@ export interface NSAVerificationPageState
|
|
|
20
20
|
isSendCode: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export class NSAVerificationPage extends React.Component<NSAVerificationPageProps, NSAVerificationPageState>
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let code = props.url.getQuery("code") ?? "";
|
|
29
|
-
useEffect(() =>
|
|
25
|
+
private NSButtonBlue_Verify = createRef<NSButtonBlue>();
|
|
26
|
+
private NSBoxString_Code = createRef<NSBoxString>();
|
|
27
|
+
constructor(props: NSAVerificationPageProps)
|
|
30
28
|
{
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
// eslint-disable-next-line
|
|
39
|
-
}, [code, NSButtonBlue_Verify.current]);
|
|
40
|
-
|
|
41
|
-
const [state, setState] = useState<NSAVerificationPageState>({
|
|
42
|
-
isSendCode: code.length > 0
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
async function onRequest(onFinshied: () => void)
|
|
29
|
+
super(props);
|
|
30
|
+
this.state = { isSendCode: false };
|
|
31
|
+
this.onRequest = this.onRequest.bind(this);
|
|
32
|
+
this.onVerify = this.onVerify.bind(this);
|
|
33
|
+
}
|
|
34
|
+
private async onRequest(onFinshied: () => void)
|
|
46
35
|
{
|
|
47
36
|
try
|
|
48
37
|
{
|
|
49
|
-
props.onRequest(props.getContactValue(true)).then(() =>
|
|
38
|
+
this.props.onRequest(this.props.getContactValue(true)).then(() =>
|
|
50
39
|
{
|
|
51
|
-
setState(
|
|
52
|
-
props.notifier.onSuccess(`Verification code has been sent successfully.`);
|
|
40
|
+
this.setState({ isSendCode: true });
|
|
41
|
+
this.props.notifier.onSuccess(`Verification code has been sent successfully.`);
|
|
53
42
|
onFinshied();
|
|
54
43
|
}).catch(onFinshied);
|
|
55
44
|
} catch (error)
|
|
56
45
|
{
|
|
57
|
-
props.notifier.onError(error as Error);
|
|
46
|
+
this.props.notifier.onError(error as Error);
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
|
-
|
|
61
|
-
async function onVerify(onFinshied: () => void)
|
|
49
|
+
private async onVerify(onFinshied: () => void)
|
|
62
50
|
{
|
|
63
51
|
try
|
|
64
52
|
{
|
|
65
|
-
let code = NSBoxString_Code.current?.getValue() ?? "";
|
|
66
|
-
props.onVerify(code).then(() =>
|
|
53
|
+
let code = this.NSBoxString_Code.current?.getValue() ?? "";
|
|
54
|
+
this.props.onVerify(code).then(() =>
|
|
67
55
|
{
|
|
68
|
-
props.notifier.onSuccess("Verification has been done successfully.");
|
|
69
|
-
props.notifier.onSuccess("Redirecting ...", 2000);
|
|
56
|
+
this.props.notifier.onSuccess("Verification has been done successfully.");
|
|
57
|
+
this.props.notifier.onSuccess("Redirecting ...", 2000);
|
|
70
58
|
setTimeout(() =>
|
|
71
59
|
{
|
|
72
|
-
props.onFinished();
|
|
60
|
+
this.props.onFinished();
|
|
73
61
|
onFinshied();
|
|
74
62
|
}, 2000);
|
|
75
63
|
}).catch(onFinshied);
|
|
76
64
|
} catch (error)
|
|
77
65
|
{
|
|
78
|
-
props.notifier.onError(error as Error);
|
|
66
|
+
this.props.notifier.onError(error as Error);
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
69
|
+
override componentDidMount(): void
|
|
70
|
+
{
|
|
71
|
+
let code = this.props.url.getQuery("code") ?? "";
|
|
72
|
+
if (code)
|
|
73
|
+
{
|
|
74
|
+
this.setState({ isSendCode: true }, () =>
|
|
75
|
+
{
|
|
76
|
+
this.NSBoxString_Code.current?.setValue(code, () =>
|
|
77
|
+
{
|
|
78
|
+
this.NSButtonBlue_Verify.current?.performClick();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
override render(): ReactNode
|
|
84
|
+
{
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<NSSection>
|
|
88
|
+
<div
|
|
89
|
+
className={`${Styles.nsa_verification_container} ${this.props.classList?.join(" ") ?? ""}`}
|
|
90
|
+
style={this.props.style}
|
|
91
|
+
>
|
|
92
|
+
<img
|
|
93
|
+
src={"https://static.namirasoft.com/image/concept/verification/purple.png"}
|
|
94
|
+
alt={'verification vector'}
|
|
95
|
+
className={Styles.nsa_verification_vector}
|
|
96
|
+
/>
|
|
97
|
+
<div className='m-0'>
|
|
98
|
+
<p className='m-2'>Type: {this.props.contact_type}</p>
|
|
99
|
+
{
|
|
100
|
+
((this.state.isSendCode || !this.props.children) && this.props.getContactValue(false)) &&
|
|
101
|
+
<p className='m-2'>{this.props.contact_value_name}: {this.props.getContactValue(false)}</p>
|
|
102
|
+
}
|
|
103
|
+
{
|
|
104
|
+
this.props.children &&
|
|
105
|
+
<div style={{ display: this.state.isSendCode ? "none" : undefined }}>
|
|
106
|
+
{this.props.children}
|
|
107
|
+
</div>
|
|
108
|
+
}
|
|
109
|
+
</div>
|
|
100
110
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
this.state.isSendCode ?
|
|
112
|
+
<>
|
|
113
|
+
<p
|
|
114
|
+
style={{ margin: "0px" }}
|
|
115
|
+
>Please enter the code you received</p>
|
|
116
|
+
<NSBoxString
|
|
117
|
+
ref={this.NSBoxString_Code}
|
|
118
|
+
title='Verification Code'
|
|
119
|
+
placeholder='Enter the code'
|
|
120
|
+
hideHeader={true}
|
|
121
|
+
required={true}
|
|
122
|
+
min_length={6}
|
|
123
|
+
max_length={6}
|
|
124
|
+
input={{ style: { fontSize: '24px', fontWeight: "bold", textAlign: "center" } }}
|
|
125
|
+
/>
|
|
126
|
+
</> :
|
|
127
|
+
<>
|
|
128
|
+
<NSButtonBlue
|
|
129
|
+
ref={this.NSButtonBlue_Verify}
|
|
130
|
+
title='Send Code'
|
|
131
|
+
onClick={{
|
|
132
|
+
action: (onFinished) =>
|
|
133
|
+
{
|
|
134
|
+
this.onRequest(onFinished);
|
|
135
|
+
},
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
</>
|
|
105
139
|
}
|
|
106
140
|
</div>
|
|
141
|
+
<NSSpace size={NSSpaceSizeType.NORMAL}></NSSpace>
|
|
107
142
|
{
|
|
108
|
-
state.isSendCode
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<NSButtonBlue
|
|
126
|
-
ref={NSButtonBlue_Verify}
|
|
127
|
-
title='Send Code'
|
|
128
|
-
onClick={{
|
|
129
|
-
action: (onFinished) =>
|
|
130
|
-
{
|
|
131
|
-
onRequest(onFinished);
|
|
132
|
-
},
|
|
133
|
-
}}
|
|
134
|
-
/>
|
|
135
|
-
</>
|
|
143
|
+
this.state.isSendCode &&
|
|
144
|
+
<>
|
|
145
|
+
<NSButtonBlue
|
|
146
|
+
title="Verify"
|
|
147
|
+
onClick={{
|
|
148
|
+
action: (onFinished) =>
|
|
149
|
+
{
|
|
150
|
+
this.onVerify(onFinished);
|
|
151
|
+
},
|
|
152
|
+
}}
|
|
153
|
+
/>
|
|
154
|
+
<NSSpace size={NSSpaceSizeType.SMALL}></NSSpace>
|
|
155
|
+
<button onClick={() =>
|
|
156
|
+
{
|
|
157
|
+
this.setState(prevState => ({ ...prevState, isSendCode: false }))
|
|
158
|
+
}} className={Styles.nsa_resend_button}>Resend Code</button>
|
|
159
|
+
</>
|
|
136
160
|
}
|
|
137
|
-
</
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<>
|
|
142
|
-
<NSButtonBlue
|
|
143
|
-
title="Verify"
|
|
144
|
-
onClick={{
|
|
145
|
-
action: (onFinished) =>
|
|
146
|
-
{
|
|
147
|
-
onVerify(onFinished);
|
|
148
|
-
},
|
|
149
|
-
}}
|
|
150
|
-
/>
|
|
151
|
-
<NSSpace size={NSSpaceSizeType.SMALL}></NSSpace>
|
|
152
|
-
<button onClick={() =>
|
|
153
|
-
{
|
|
154
|
-
setState(prevState => ({ ...prevState, isSendCode: false }))
|
|
155
|
-
}} className={Styles.nsa_resend_button}>Resend Code</button>
|
|
156
|
-
</>
|
|
157
|
-
}
|
|
158
|
-
</NSSection >
|
|
159
|
-
</>
|
|
160
|
-
);
|
|
161
|
+
</NSSection >
|
|
162
|
+
</>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
161
165
|
}
|