Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 613e192

Browse files
committed
fix(auth): fix sign out route and button naming
The sign out button was called Register and had no functionality. It has the correct naming now and signs out the user. --- .../assets/app/configuration/router-config.js | 3 ++- resources/assets/app/services/notification.js | 4 ++++ .../app/templates/elements/navigation-top.html | 2 +- .../assets/app/view-models/auth/signout.js | 20 +++++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-)
1 parent e4db028 commit 613e192

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

resources/assets/app/configuration/router-config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export default class {
2121
{route: ['news', 'news/index'], moduleId: 'view-models/news/index', title: 'News'},
2222
{route: ['news/view/:id'], moduleId: 'view-models/news/view', title: 'News'},
2323
{route: ['users/register'], moduleId: 'view-models/users/register', title: 'Registration'},
24-
{route: ['auth/signin'], moduleId: 'view-models/auth/signin', title: 'Sign In'}
24+
{route: ['auth/signin'], moduleId: 'view-models/auth/signin', title: 'Sign In'},
25+
{route: ['auth/signout'], moduleId: 'view-models/auth/signout', title: 'Sign Out'}
2526
]);
2627
config.mapUnknownRoutes(instruction => {
2728
return 'view-models/errors/error404';

resources/assets/app/services/notification.js

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ export class Notification {
66
danger(message) {
77
console.log(message);
88
}
9+
10+
error(message) {
11+
console.log(message);
12+
}
913
}

resources/assets/app/templates/elements/navigation-top.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</li>
3434
<li class="nav-item" if.bind="isAuthenticated">
3535
<a class="nav-link" href="/auth/signout">
36-
<i class="fa fa-user fa-fw"></i> Register
36+
<i class="fa fa-sign-out fa-fw"></i> Sign Out
3737
</a>
3838
</li>
3939
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {inject} from 'aurelia-framework';
2+
import {noView} from 'aurelia-templating';
3+
import {AuthService} from 'aurelia-auth';
4+
5+
import {Notification} from 'services/notification';
6+
7+
@noView
8+
@inject(AuthService, Notification)
9+
export class Signout {
10+
constructor(auth, notification) {
11+
this.auth = auth;
12+
this.notification = notification;
13+
}
14+
15+
activate() {
16+
this.auth.logout("/auth/signin")
17+
.then(response => this.notification.success("Signed out successfully"))
18+
.catch(err => this.notification.error("Error signing out"));
19+
}
20+
}

0 commit comments

Comments
 (0)