Skip to content

Commit

Permalink
Login/HomePage has auth check and login form, account menu is shown w…
Browse files Browse the repository at this point in the history
…hen logged in
  • Loading branch information
natlibfi-kmskuusi committed May 15, 2024
1 parent 338cc9f commit eb7aeaf
Show file tree
Hide file tree
Showing 3 changed files with 352 additions and 258 deletions.
8 changes: 4 additions & 4 deletions src/clients/common/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export const Account = {
return new Promise((resolve, reject) => {
const token = this.getToken();
if (token) {
resolve(authVerify(this.getToken()));
return resolve(authVerify(this.getToken()));
}
const message = 'Token was not available. Skip verify, request login';
console.warn(message);
reject(new Error(message));
return reject(new Error(message));
});
},
async login(username, password) {
Expand Down Expand Up @@ -111,7 +111,7 @@ export function doLogin(onSuccess) {
startProcess();

Account.login(username, password)
.then((user) => { onSuccess(user); })
.then((user) => { console.log('Login Success'); onSuccess(user); })
.catch(err => {
console.log(err);
Account.remove();
Expand All @@ -126,7 +126,7 @@ export function doLogin(onSuccess) {

Account.verify()
.then(response => {
console.log('Verify got reponse, essentially verify is success');
console.log('Verify has success');
onSuccess(Account.get());
})
.catch(noAuth);
Expand Down
Loading

0 comments on commit eb7aeaf

Please sign in to comment.