From 9d5307a479be4a2c5d8046824aaac762e26203b6 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Fri, 24 Feb 2023 14:32:31 +0000 Subject: [PATCH] use `AuthModel` --- packages/app/src/components/Login/index.jsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/app/src/components/Login/index.jsx b/packages/app/src/components/Login/index.jsx index 3be5a85e..c78ff71c 100755 --- a/packages/app/src/components/Login/index.jsx +++ b/packages/app/src/components/Login/index.jsx @@ -2,6 +2,7 @@ import React from "react" import * as antd from "antd" import { Icons } from "components/Icons" +import AuthModel from "models/auth" import config from "config" import "./index.less" @@ -80,17 +81,16 @@ export default class Login extends React.Component { this.clearError() this.toogleLoading(true) - this.props.sessionController.login(payload, (error, response) => { + const loginProcess = await AuthModel.login(payload).catch((error) => { this.toogleLoading(false) + this.onError(error) - if (error) { - return this.onError(error) - } else { - if (response.status === 200) { - this.onDone() - } - } + return false }) + + if (loginProcess) { + this.onDone() + } } onDone = () => {