-
+ {locationDetail.critics_review.length > 0 ?
+ <>
+
-
-
-
-
-
-
-
-
-
- Video
-
+
+
+ {locationDetail.critics_review.map(x => (
+
-
-
-
- ))}
+ ))}
+ >
+
+ :
+ <>
+
No Critics review to display
+ >
+
+ }
diff --git a/src/services/auth.ts b/src/services/auth.ts
index c678ac2..9221e5a 100644
--- a/src/services/auth.ts
+++ b/src/services/auth.ts
@@ -2,7 +2,7 @@ import { AxiosError } from "axios";
import { LOGIN_URI, SIGNUP_URI } from "../constants/api";
import { client } from "./config";
-const initialState: IEmptyResponseState = {
+const initialState: IHttpResponse = {
data: null,
error: AxiosError
}
diff --git a/src/services/review.ts b/src/services/review.ts
index 7102a49..5810f3e 100644
--- a/src/services/review.ts
+++ b/src/services/review.ts
@@ -2,9 +2,10 @@ import { AxiosError } from "axios"
import { client } from "./config";
import { GET_CURRENT_USER_REVIEW_LOCATION_URI, POST_REVIEW_LOCATION_URI } from "../constants/api";
-const initialState: IEmptyResponseState = {
+const initialState: IHttpResponse = {
data: null,
- error: AxiosError
+ error: AxiosError,
+ status: 0,
}
interface postReviewLocationReq {
@@ -29,7 +30,7 @@ async function postReviewLocation(req: postReviewLocationReq) {
}
}
-async function getCurrentUserLocationReviewService(location_id: number) {
+async function getCurrentUserLocationReviewService(location_id: number): Promise {
const newState = { ...initialState };
try {
const response = await client({ method: 'GET', url: `${GET_CURRENT_USER_REVIEW_LOCATION_URI}/${location_id}`, withCredentials: true})
@@ -37,7 +38,10 @@ async function getCurrentUserLocationReviewService(location_id: number) {
newState.error = null
return newState
} catch (err) {
- throw err;
+ let error = err as AxiosError;
+ newState.error = error
+ newState.status = error.response?.status;
+ throw(newState)
}
}
diff --git a/src/types/common.ts b/src/types/common.ts
index 9d0fc2e..1ae1d49 100644
--- a/src/types/common.ts
+++ b/src/types/common.ts
@@ -7,7 +7,8 @@ interface GetRequestPagination {
}
-interface IEmptyResponseState {
+interface IHttpResponse {
data: any,
error: any,
+ status?: number,
};
\ No newline at end of file