Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #471 from aziiee/login_redirect
Browse files Browse the repository at this point in the history
fix(auth): Redirect to SSO if authentication fails
  • Loading branch information
Akanksh Saxena authored Aug 20, 2020
2 parents 324fcdd + e53d12c commit 542b78d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/protected/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@ export default Route.extend(AuthenticatedRouteMixin, {
media: service("media"),
store: service(),
ajax: service(),
router: service(),

async model() {
const user = await this.ajax.request("/api/v1/users/me", {
method: "GET",
data: {
include: "supervisors,supervisees"
}
});
let user;
try {
user = await this.ajax.request("/api/v1/users/me", {
method: "GET",
data: {
include: "supervisors,supervisees"
}
});
} catch (error) {
this.router.transitionTo("login");
}

await this.store.pushPayload("user", user);

Expand Down

0 comments on commit 542b78d

Please sign in to comment.