mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-08-03 10:03:20 +08:00
Added login functionality
This commit is contained in:
parent
26b3db25f0
commit
a634f07f2b
3 changed files with 43 additions and 9 deletions
|
@ -40,11 +40,13 @@ export function UserLogin(user: LoginParams) {
|
|||
.post("/api/v1/accounts/token/login/", user)
|
||||
.then(async (response) => {
|
||||
AsyncStorage.setItem("token", JSON.stringify(response.data.auth_token));
|
||||
return true;
|
||||
return [true];
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Login Failed: " + error);
|
||||
return false;
|
||||
console.log(
|
||||
"Login Failed: " + error.response.status + " " + error.response.data
|
||||
);
|
||||
return [false, error.response.data];
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue