Skip to main content

# getApiActionCreator()

    function getApiActionCreator(api: string): (operation: string) => {
    [key: string]: ActionCreatorWithoutPayload<`${string}/${string}`>;
    };

## Parameters​

### api​

`string`

API name for which Redux Action Creators are required

## Returns​

Redux Action Creators util function

    (operation: string): {
    [key: string]: ActionCreatorWithoutPayload<`${string}/${string}`>;
    };

### Parameters​

#### operation​

`string`

### Returns​

    {
    [key: string]: ActionCreatorWithoutPayload<`${string}/${string}`>;
    }

## Description​

Creates API Redux Action Creators

## Examples​

    import { getApiActionCreator } from '@elliemae/pui-app-sdk';
     const loansActionCreator = getApiActionCreator('loans');

     export const loans = {
       ...loansActionCreator('create'),
       ...loansActionCreator('get'),
       ...loansActionCreator('save'),
     };

     const loansSlice = createSlice({
       name: 'loans',
       initialState: [],
       reducers: {
         getSuccess: (state, { payload }) => {
           state.push(...payload);
         },
         saveSuccess: (state, { payload }) => {
           state.push(payload);
         },
       },
     });