Dashboard and nginx fixes
Change-Id: I4ee34b24779f929f41852d4662018caead860ab6
diff --git a/src/app/datasources/rest/auth.rest.ts b/src/app/datasources/rest/auth.rest.ts
index e7a593c..f963799 100644
--- a/src/app/datasources/rest/auth.rest.ts
+++ b/src/app/datasources/rest/auth.rest.ts
@@ -21,7 +21,8 @@
export interface IXosAuthService {
login(data: IAuthRequestData): Promise<any>;
logout(): Promise<any>;
- getUser(): IXosUser;
+ getUser(): any; // NOTE how to define return user || false ???
+ isAuthenticated(): boolean;
}
export class AuthService {
@@ -67,6 +68,16 @@
}
public getUser(): IXosUser {
- return JSON.parse(this.$cookies.get('xosuser'));
+ const user = this.$cookies.get('xosuser');
+ if (angular.isDefined(user)) {
+ return JSON.parse(user);
+ }
+ return;
+ }
+
+ public isAuthenticated(): boolean {
+ const token = this.$cookies.get('xoscsrftoken');
+ const session = this.$cookies.get('xossessionid');
+ return angular.isDefined(token) && angular.isDefined(session);
}
}
diff --git a/src/app/datasources/rest/model.rest.ts b/src/app/datasources/rest/model.rest.ts
index 908ca0f..eca4221 100644
--- a/src/app/datasources/rest/model.rest.ts
+++ b/src/app/datasources/rest/model.rest.ts
@@ -16,6 +16,6 @@
}
public getResource(url: string): ng.resource.IResourceClass<ng.resource.IResource<any>> {
- return this.resource = this.$resource(`${AppConfig.apiEndpoint}${url}/:id`);
+ return this.resource = this.$resource(`${AppConfig.apiEndpoint}${url}/:id`, {id: '@id'});
}
}
diff --git a/src/app/datasources/stores/model.store.ts b/src/app/datasources/stores/model.store.ts
index fa3ab06..0839cc7 100644
--- a/src/app/datasources/stores/model.store.ts
+++ b/src/app/datasources/stores/model.store.ts
@@ -18,6 +18,8 @@
private ModelRest: IXosResourceService
) {
}
+ // FIXME if called multiple time (for different collection),
+ // it return the same observable while it should return different ones
query(model: string) {
this.loadInitialData(model);