File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of NER's FinishLine and licensed under GNU AGPLv3.
3+ * See the LICENSE file in the repository root folder for details.
4+ */
5+ import axios from '../utils/axios' ;
6+ import { apiUrls } from '../utils/urls' ;
7+ import { designReviewTransformer } from '../../../backend/src/transformers/design-review.transformer' ;
8+
9+ /**
10+ * Gets all the design reviews
11+ */
12+ export const getAllDesignReviews = ( ) => {
13+ return axios . get ( apiUrls . designReviews ( ) , {
14+ transformResponse : ( data ) => JSON . parse ( data ) . map ( designReviewTransformer )
15+ } ) ;
16+ } ;
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of NER's FinishLine and licensed under GNU AGPLv3.
3+ * See the LICENSE file in the repository root folder for details.
4+ */
5+ import { useQuery } from 'react-query' ;
6+ import { getAllDesignReviews } from '../apis/design-reviews.api' ;
7+ import { DesignReview } from 'shared' ;
8+
9+ /**
10+ * Custom react hook to get all design reviews
11+ *
12+ * @returns all the design reviews
13+ */
14+ export const useGetAllDesignReviews = ( ) => {
15+ return useQuery < DesignReview [ ] , Error > ( [ 'design-reviews' ] , async ( ) => {
16+ const { data } = await getAllDesignReviews ( ) ;
17+ return data ;
18+ } ) ;
19+ } ;
Original file line number Diff line number Diff line change @@ -129,6 +129,9 @@ const bomCreateManufacturer = () => `${bomEndpoints()}/manufacturer/create`;
129129const bomCreateMaterialType = ( ) => `${ bomEndpoints ( ) } /material-type/create` ;
130130const bomCreateUnit = ( ) => `${ bomEndpoints ( ) } /units/create` ;
131131
132+ /**************** Design Reviews Endpoints ****************/
133+ const designReviews = ( ) => `${ API_URL } /design-reviews` ;
134+
132135/**************** Other Endpoints ****************/
133136const version = ( ) => `https://api.github.com/repos/Northeastern-Electric-Racing/FinishLine/releases/latest` ;
134137
@@ -181,6 +184,8 @@ export const apiUrls = {
181184 changeRequestCreateProposeSolution,
182185 changeRequestRequestReviewer,
183186
187+ designReviews,
188+
184189 teams,
185190 teamsById,
186191 teamsDelete,
You can’t perform that action at this time.
0 commit comments