18 lines
516 B
TypeScript
18 lines
516 B
TypeScript
import { getCustomerDetails } from '@api';
|
|
import { CustomerResponse } from '@interfaces';
|
|
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
|
|
export const fetchCustomerDetails = createAsyncThunk<CustomerResponse>(
|
|
'customer/fetchCustomerDetails',
|
|
async (_, { rejectWithValue }) => {
|
|
try {
|
|
const response = await getCustomerDetails();
|
|
console.log(response);
|
|
return response;
|
|
} catch (error: any) {
|
|
console.log(error);
|
|
return rejectWithValue(error?.message);
|
|
}
|
|
},
|
|
);
|