import { createAction, createAsyncThunk } from '@reduxjs/toolkit'; import { addCustomerApi } from '@api'; import { AddCustomerPayload, AddCustomerResponse } from '@interfaces'; export const resetAddCustomerState = createAction('addCustomer/resetState'); export const addCustomer = createAsyncThunk( 'addCustomer/addCustomer', async (payload, { rejectWithValue }) => { try { return await addCustomerApi(payload); } catch (error: any) { return rejectWithValue(error.message || 'Failed to add customer'); } }, );