refactor: use handleResponse on login
This commit is contained in:
parent
729414c45a
commit
b3f0044723
|
@ -86,20 +86,15 @@ export const createPortalAuthProvider = (sdk: Sdk): AuthProvider => {
|
|||
password: params.password,
|
||||
});
|
||||
|
||||
let redirectTo: string | undefined;
|
||||
|
||||
if (ret) {
|
||||
redirectTo = params.redirectTo;
|
||||
if (!redirectTo) {
|
||||
redirectTo = ret ? "/dashboard" : "/login";
|
||||
}
|
||||
return handleResponse({
|
||||
ret, redirectToSuccess: "/dashboard", redirectToError: "/login", successCb: () => {
|
||||
sdk.setAuthToken(sdk.account().jwtToken);
|
||||
}
|
||||
}, successNotification: {
|
||||
message: "Login Successful",
|
||||
description: "You have successfully logged in."
|
||||
|
||||
return {
|
||||
success: ret,
|
||||
redirectTo,
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async logout(params: any): Promise<AuthActionResponse> {
|
||||
|
|
Loading…
Reference in New Issue