import { createAction, createAsyncThunk } from '@reduxjs/toolkit'; import { addLeadApi } from '@api'; import { AddLeadPayload, AddLeadResponse } from '@interfaces'; export const resetAddLeadState = createAction('addLead/resetState'); export const addLead = createAsyncThunk( 'addLead/addLead', async (payload, { rejectWithValue }) => { try { return await addLeadApi(payload); } catch (error: any) { return rejectWithValue(error.message || 'Failed to add lead'); } }, );