+ window.location.assign(`${this.baseUrl || ""}/logout?return_to=${currentUrl}`);
+ }
+
+ public getUserDetails = (): Promise<User> => {
+ const reqId = uuid();
+ this.actions.progressFn(reqId, true);
+ return this.apiClient
+ .get<UserDetailsResponse>('/users/current')
+ .then(resp => {
+ this.actions.progressFn(reqId, false);
+ const prefs = resp.data.prefs.profile ? resp.data.prefs : { profile: {}};
+ console.log(resp.data);
+ return {
+ email: resp.data.email,
+ firstName: resp.data.first_name,
+ lastName: resp.data.last_name,
+ uuid: resp.data.uuid,
+ ownerUuid: resp.data.owner_uuid,
+ isAdmin: resp.data.is_admin,
+ identityUrl: resp.data.identity_url,
+ prefs
+ };
+ })
+ .catch(e => {
+ this.actions.progressFn(reqId, false);
+ this.actions.errorFn(reqId, e);
+ throw e;
+ });
+ }
+
+ public getRootUuid() {
+ const uuid = this.getOwnerUuid();
+ const uuidParts = uuid ? uuid.split('-') : [];
+ return uuidParts.length > 1 ? `${uuidParts[0]}-${uuidParts[1]}` : undefined;