20 lines
649 B
TypeScript
20 lines
649 B
TypeScript
import { createAction, createAsyncThunk } from '@reduxjs/toolkit';
|
|
import { getDashboardLeadCountApi } from '@api';
|
|
import { DashboardLeadCountItem, DashboardLeadCountPayload } from '@interfaces';
|
|
|
|
export const resetDashboardState = createAction('dashboard/resetState');
|
|
|
|
export const getDashboardLeadCount = createAsyncThunk<
|
|
DashboardLeadCountItem[],
|
|
DashboardLeadCountPayload
|
|
>(
|
|
'dashboard/getLeadCount',
|
|
async (payload, { rejectWithValue }) => {
|
|
try {
|
|
return await getDashboardLeadCountApi(payload);
|
|
} catch (error: any) {
|
|
return rejectWithValue(error.message || 'Failed to load dashboard lead count');
|
|
}
|
|
},
|
|
);
|