mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
execute a callback if presented
This commit is contained in:
parent
3b87fa895b
commit
7fcbedc8f4
@ -4,7 +4,7 @@ import SessionModel from "../session"
|
||||
const emailRegex = new RegExp(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)
|
||||
|
||||
export default class AuthModel {
|
||||
static login = async (payload) => {
|
||||
static login = async (payload, callback) => {
|
||||
const response = await request({
|
||||
method: "post",
|
||||
url: "/auth/login",
|
||||
@ -16,6 +16,10 @@ export default class AuthModel {
|
||||
|
||||
SessionModel.token = response.data.token
|
||||
|
||||
if (typeof callback === "function") {
|
||||
await callback()
|
||||
}
|
||||
|
||||
__comty_shared_state.eventBus.emit("auth:login_success")
|
||||
|
||||
return response.data
|
||||
|
Loading…
x
Reference in New Issue
Block a user