Added logout
Change-Id: If09690e089976244ded58a27b1f35a3a850ae2d1
diff --git a/src/app/datasources/rest/auth.rest.ts b/src/app/datasources/rest/auth.rest.ts
index 1792920..e7a593c 100644
--- a/src/app/datasources/rest/auth.rest.ts
+++ b/src/app/datasources/rest/auth.rest.ts
@@ -13,9 +13,15 @@
};
}
+export interface IXosUser {
+ id: number;
+ email: string;
+}
+
export interface IXosAuthService {
login(data: IAuthRequestData): Promise<any>;
logout(): Promise<any>;
+ getUser(): IXosUser;
}
export class AuthService {
@@ -44,7 +50,7 @@
public logout(): Promise<any> {
const d = this.$q.defer();
- this.$http.post(`${AppConfig.apiEndpoint}/utility/login/`, {
+ this.$http.post(`${AppConfig.apiEndpoint}/utility/logout/`, {
xoscsrftoken: this.$cookies.get('xoscsrftoken'),
xossessionid: this.$cookies.get('xossessionid')
})
@@ -59,4 +65,8 @@
});
return d.promise;
}
+
+ public getUser(): IXosUser {
+ return JSON.parse(this.$cookies.get('xosuser'));
+ }
}