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>(),
20 USER_DETAILS_REQUEST: {},
21 USER_DETAILS_SUCCESS: ofType<UserDetailsResponse>()
27 export type AuthAction = UnionOf<typeof actions>;
28 export default actions;
30 export const getUserDetails = () => (dispatch: Dispatch) => {
31 dispatch(actions.USER_DETAILS_REQUEST());
33 .get<UserDetailsResponse>('/users/current')
35 dispatch(actions.USER_DETAILS_SUCCESS(resp.data));