Skip to content

Commit

Permalink
Merge pull request #99 from SOPT-all/develop
Browse files Browse the repository at this point in the history
merge to main
  • Loading branch information
seong-hui authored Nov 28, 2024
2 parents 0bb3ad5 + 0e9025e commit d34f2f1
Show file tree
Hide file tree
Showing 172 changed files with 4,994 additions and 235 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
"stylelint-order": "^6.0.4",
"typescript": "~5.6.2",
"vite": "^5.4.10",
"vite-tsconfig-paths": "^5.1.2"
"vite-tsconfig-paths": "^5.1.3"
}
}
14 changes: 10 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { Global, ThemeProvider } from '@emotion/react';

import Route from '@route/Route';
import GLOBALSTYLE from '@styles/global';
import Theme from '@styles/theme';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

const queryClient = new QueryClient();

const App = () => (
<ThemeProvider theme={Theme}>
<Global styles={GLOBALSTYLE} />
<Route />
</ThemeProvider>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={Theme}>
<Global styles={GLOBALSTYLE} />
<Route />
</ThemeProvider>
</QueryClientProvider>
);

export default App;
10 changes: 10 additions & 0 deletions src/apis/instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import axios from 'axios';

const instance = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_URL,
headers: {
'Content-Type': 'application/json',
},
});

export default instance;
29 changes: 29 additions & 0 deletions src/apis/productPage/product/getProduct.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import instance from '@apis/instance';

interface ProductResponse {
productId: number;
productImage: string;
detail: string;
priceOriginal: number;
percent: number;
priceDiscount: number;
isCoupon: boolean;
categoryName: string;
reviewCount: number;
rating: number;
}

interface RelatedProductsResponse {
success: boolean;
data: {
products: ProductResponse[];
};
error: string | null;
}

const fetchRelatedProducts = async (productId: number): Promise<ProductResponse[]> => {
const response = await instance.get<RelatedProductsResponse>(`/api/products/${productId}/related`);
return response.data.data.products;
};

export default fetchRelatedProducts;
12 changes: 12 additions & 0 deletions src/apis/productPage/product/productQueries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useQuery } from '@tanstack/react-query';
import fetchRelatedProducts from './getProduct';

const useRelatedProducts = (productId: number) => {
return useQuery({
queryKey: ['relatedProducts', productId],
queryFn: () => fetchRelatedProducts(productId),
initialData: [],
});
};

export default useRelatedProducts;
4 changes: 4 additions & 0 deletions src/assets/icons/btn_left_defalut.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/btn_right_default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/icons/card_deliverstatus_1_final.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/icons/card_deliverstatus_2_final.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d34f2f1

Please sign in to comment.