Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
#38 use backend data
Browse files Browse the repository at this point in the history
  • Loading branch information
wobkenh committed Mar 27, 2020
1 parent ecac3c2 commit 88b86f1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions client/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,21 @@ export default {
// TODO: Where to forward to when user directly accessed the login page?
forwardToPath = "/prototype/register-patient";
}
Api.postAuthentication().then((user, error) => {
Api.postAuthentication({
userName: values.id,
password: values.password
}).then((tokenObject, error) => {
if (error) {
console.error("Error at login: ");
console.error(error);
return;
}
authenticationStore.user = user;
localStorage.setItem("user", user);
const token = tokenObject.token;
// TODO: Parse token
authenticationStore.user = {
token: token,
};
localStorage.setItem("user", token);
});
// localStorage.setItem("user", "test"); // TODO: Call Backend
// authenticationStore.user = { // TODO: Decode JWT to get user object
Expand Down

0 comments on commit 88b86f1

Please sign in to comment.