X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7ba0401cff3906814ba976ea36adab9b3d5c3922..1a9eb2261e6030ba78078e2a206bad27653f2475:/src/store/auth/auth-reducer.ts diff --git a/src/store/auth/auth-reducer.ts b/src/store/auth/auth-reducer.ts index e58b2535e6..f6974fd207 100644 --- a/src/store/auth/auth-reducer.ts +++ b/src/store/auth/auth-reducer.ts @@ -6,12 +6,11 @@ import actions, { AuthAction } from "./auth-action"; import { User } from "../../models/user"; import { authService } from "../../services/services"; import { removeServerApiAuthorizationHeader, setServerApiAuthorizationHeader } from "../../common/api/server-api"; -import { UserDetailsResponse } from "../../services/auth-service/auth-service"; export interface AuthState { user?: User; apiToken?: string; -}; +} const authReducer = (state: AuthState = {}, action: AuthAction) => { return actions.match(action, { @@ -39,14 +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, - uuid: ud.uuid, - ownerUuid: ud.owner_uuid - }; + USER_DETAILS_SUCCESS: (user: User) => { authService.saveUser(user); return {...state, user}; },