15 lines
492 B
TypeScript
15 lines
492 B
TypeScript
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
import { getCustomerDetailsApi } from '@api';
|
|
import { CustomerItem } from '@interfaces';
|
|
|
|
export const getCustomerDetails = createAsyncThunk<
|
|
CustomerItem,
|
|
{ userid: string }
|
|
>('customerDetails/getCustomerDetails', async (payload, { rejectWithValue }) => {
|
|
try {
|
|
return await getCustomerDetailsApi(payload.userid);
|
|
} catch (error: any) {
|
|
return rejectWithValue(error.message || 'Failed to load customer details');
|
|
}
|
|
});
|