19 lines
503 B
TypeScript
19 lines
503 B
TypeScript
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
import { giveRatingPayload } from '@interfaces';
|
|
import { giveRatingApi } from '@api';
|
|
|
|
export const submitReview = createAsyncThunk(
|
|
'order/submitReview',
|
|
async (
|
|
{ id, payload }: { id: string; payload: giveRatingPayload },
|
|
{ rejectWithValue },
|
|
) => {
|
|
try {
|
|
const response = await giveRatingApi(id, payload);
|
|
return response;
|
|
} catch (error: any) {
|
|
return rejectWithValue(error.response?.data);
|
|
}
|
|
},
|
|
);
|