mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
use AuthModel
This commit is contained in:
parent
3faf61b2d5
commit
9d5307a479
@ -2,6 +2,7 @@ import React from "react"
|
|||||||
import * as antd from "antd"
|
import * as antd from "antd"
|
||||||
import { Icons } from "components/Icons"
|
import { Icons } from "components/Icons"
|
||||||
|
|
||||||
|
import AuthModel from "models/auth"
|
||||||
import config from "config"
|
import config from "config"
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
@ -80,17 +81,16 @@ export default class Login extends React.Component {
|
|||||||
this.clearError()
|
this.clearError()
|
||||||
this.toogleLoading(true)
|
this.toogleLoading(true)
|
||||||
|
|
||||||
this.props.sessionController.login(payload, (error, response) => {
|
const loginProcess = await AuthModel.login(payload).catch((error) => {
|
||||||
this.toogleLoading(false)
|
this.toogleLoading(false)
|
||||||
|
this.onError(error)
|
||||||
|
|
||||||
if (error) {
|
return false
|
||||||
return this.onError(error)
|
|
||||||
} else {
|
|
||||||
if (response.status === 200) {
|
|
||||||
this.onDone()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (loginProcess) {
|
||||||
|
this.onDone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDone = () => {
|
onDone = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user