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:
2026-01-14 00:10:46 +01:00
parent 2213e115c6
commit 98426f8b05
4 changed files with 47 additions and 6 deletions

View File

@@ -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;
};