Add product review model, serializer, and API endpoint
Introduces a Review model for product reviews, including rating and comment fields. Adds a public serializer and a ModelViewSet for reviews with search and ordering capabilities. Also updates the frontend API client to use the correct token refresh endpoint and improves FormData handling.
This commit is contained in:
@@ -22,7 +22,7 @@ privateApi.interceptors.response.use(
|
||||
original._retry = true;
|
||||
|
||||
try {
|
||||
await privateApi.post("/auth/refresh/");
|
||||
await privateApi.post("/api/account/token/refresh/");
|
||||
return privateApi(original);
|
||||
} catch {
|
||||
// optional: logout
|
||||
@@ -37,6 +37,11 @@ privateApi.interceptors.response.use(
|
||||
export const privateMutator = async <T>(
|
||||
config: AxiosRequestConfig
|
||||
): Promise<T> => {
|
||||
// If sending FormData, remove Content-Type header to let axios set it with boundary
|
||||
if (config.data instanceof FormData) {
|
||||
delete config.headers?.['Content-Type'];
|
||||
}
|
||||
|
||||
const response = await privateApi.request<T>(config);
|
||||
return response.data;
|
||||
};
|
||||
Reference in New Issue
Block a user