X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c90e813adcec89899d9db95843295a84fb058c3e..f239b9e88677d82a48b6b565ab2fd407d1171729:/src/store/auth/auth-action.ts diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index a6e6f79794..8b268cce5d 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -4,10 +4,11 @@ import { ofType, default as unionize, UnionOf } from "unionize"; import { Dispatch } from "redux"; -import { authService } from "../../services/services"; import { User } from "../../models/user"; +import { RootState } from "../store"; +import { ServiceRepository } from "../../services/services"; -const actions = unionize({ +export const authActions = unionize({ SAVE_API_TOKEN: ofType(), LOGIN: {}, LOGOUT: {}, @@ -19,14 +20,12 @@ const actions = unionize({ value: 'payload' }); -export const getUserDetails = () => (dispatch: Dispatch): Promise => { - dispatch(actions.USER_DETAILS_REQUEST()); - return authService.getUserDetails().then(details => { - dispatch(actions.USER_DETAILS_SUCCESS(details)); +export const getUserDetails = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise => { + dispatch(authActions.USER_DETAILS_REQUEST()); + return services.authService.getUserDetails().then(details => { + dispatch(authActions.USER_DETAILS_SUCCESS(details)); return details; }); }; - -export type AuthAction = UnionOf; -export default actions; +export type AuthAction = UnionOf;