From 014b19a906bfe361eb2f969c546f36ee40d1df8f Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 15 Aug 2023 18:43:53 +0000 Subject: [PATCH] pass `onDone` as callback --- packages/app/src/components/Login/index.jsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/app/src/components/Login/index.jsx b/packages/app/src/components/Login/index.jsx index e5c2dac7..79e4803a 100755 --- a/packages/app/src/components/Login/index.jsx +++ b/packages/app/src/components/Login/index.jsx @@ -53,7 +53,7 @@ export default class Login extends React.Component { this.clearError() this.toggleLoading(true) - const loginProcess = await AuthModel.login(payload).catch((error) => { + await AuthModel.login(payload, () => this.onDone()).catch((error) => { console.error(error, error.response) this.toggleLoading(false) @@ -61,21 +61,20 @@ export default class Login extends React.Component { return false }) - - if (loginProcess) { - this.onDone() - } } - onDone = () => { + onDone = async () => { + if (typeof this.props.close === "function") { + await this.props.close({ + unlock: true + }) + } + if (typeof this.props.onDone === "function") { this.props.onDone() } - if (typeof this.props.close === "function") { - this.props.unlock() - this.props.close() - } + return true } onClickRegister = () => {