Merge branch 'master'
[arvados.git] / src / store / auth / auth-reducer.ts
index 3fad4cf7569019b3ecbc1ed0d7b8d047e5f2c219..f6974fd2073be49a5c01fe6677bff22edbc4ae8d 100644 (file)
@@ -5,13 +5,12 @@
 import actions, { AuthAction } from "./auth-action";
 import { User } from "../../models/user";
 import { authService } from "../../services/services";
-import { removeServerApiAuthorizationHeader, setServerApiAuthorizationHeader } from "../../common/server-api";
-import { UserDetailsResponse } from "../../services/auth-service/auth-service";
+import { removeServerApiAuthorizationHeader, setServerApiAuthorizationHeader } from "../../common/api/server-api";
 
 export interface AuthState {
     user?: User;
     apiToken?: string;
-};
+}
 
 const authReducer = (state: AuthState = {}, action: AuthAction) => {
     return actions.match(action, {
@@ -39,12 +38,7 @@ const authReducer = (state: AuthState = {}, action: AuthAction) => {
             authService.logout();
             return {...state, apiToken: undefined};
         },
-        USER_DETAILS_SUCCESS: (ud: UserDetailsResponse) => {
-            const user = {
-                email: ud.email,
-                firstName: ud.first_name,
-                lastName: ud.last_name
-            };
+        USER_DETAILS_SUCCESS: (user: User) => {
             authService.saveUser(user);
             return {...state, user};
         },