2026-07-16 18:26:01 +05:30

15 lines
466 B
TypeScript

import { createAsyncThunk } from '@reduxjs/toolkit';
import { getLeadsApi } from '@api';
import { LeadItem } from '@interfaces';
export const getLeads = createAsyncThunk<
LeadItem[],
{ leadId: string | null; staffid: string }
>('leads/getLeads', async (payload, { rejectWithValue }) => {
try {
return await getLeadsApi(payload.leadId, payload.staffid);
} catch (error: any) {
return rejectWithValue(error.message || 'Failed to load leads');
}
});