1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { serverApi } from "../../common/server-api";
6 import { ofType, default as unionize, UnionOf } from "unionize";
7 import { Dispatch } from "redux";
9 export interface UserDetailsResponse {
16 const actions = unionize({
17 SAVE_API_TOKEN: ofType<string>(),
21 USER_DETAILS_REQUEST: {},
22 USER_DETAILS_SUCCESS: ofType<UserDetailsResponse>()
28 export type AuthAction = UnionOf<typeof actions>;
29 export default actions;
31 export const getUserDetails = () => (dispatch: Dispatch) => {
32 dispatch(actions.USER_DETAILS_REQUEST());
34 .get<UserDetailsResponse>('/users/current')
36 dispatch(actions.USER_DETAILS_SUCCESS(resp.data));