Skip to content

Commit 1a22464

Browse files
author
Jonas Gauffin
committed
cloud logins
1 parent 2b99f5b commit 1a22464

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Server/Coderr.Server.WebSite/ClientApp/src/api-authorization/authorize.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class AuthorizeGuard implements CanActivate {
2121

2222
var loginUrl = localStorage.getItem('loginUrl');
2323
if (loginUrl) {
24-
window.location = loginUrl;
24+
window.location.href = loginUrl;
2525
return false;
2626
}
2727

src/Server/Coderr.Server.WebSite/ClientApp/src/app/utils/HttpClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Injectable } from '@angular/core';
22
import { Router } from '@angular/router';
3+
declare var window: any;
34

45
export interface IRequestOptions {
56
method?: "GET" | "POST" | "PUT" | "DELETE",
@@ -68,6 +69,14 @@ export class ApiClient {
6869
var json = JSON.stringify(query);
6970
var response = await this.http.post(`${this.cqsUrl}?type=${query.constructor.TYPE_NAME}`, json, { headers: headers });
7071
if (response.statusCode === 401) {
72+
73+
// to support Cloud logins.
74+
let url = localStorage.getItem('loginUrl');
75+
if (url && url != '/account/login') {
76+
window.location.href = url;
77+
return null;
78+
}
79+
7180
this.router.navigate(['account/login'], { queryParams: { returnUrl: window.location.pathname + window.location.search } });
7281
throw new HttpError(response);
7382
}

0 commit comments

Comments
 (0)