Skip to content

Commit

Permalink
fix: ai오류 수정
Browse files Browse the repository at this point in the history
fix: ai오류 수정
  • Loading branch information
jeongs9203 committed Nov 30, 2023
2 parents 705a0a7 + 48bdb6b commit f3a4e2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
21 changes: 10 additions & 11 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,38 @@ import loading from './loading';
import { ProductList } from '@/types/product/productList';

async function getProductData() {
try{
try {
const res = await fetch(`${process.env.BASE_API_URL}/api/v1/product/product-find?categoryType=all&isDiscount=false&page=1`, {
cache: 'no-cache',
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})

const data = await res.json();
// console.log('data', data)
return data
}
catch(err){
catch (err) {
console.log(err);
}
}

const PageHome = async () => {

const myData = await getProductData();
console.log('myData', myData)
return (
<div className="nc-PageHome relative overflow-hidden">
<SectionHero2 />
<div className="container relative space-y-16 my-24">
<Suspense fallback={<p>...loading</p>}>
<SectionSliderProductCard
category='all'
heading='HOT 신상'
produdtData={myData.result as ProductList[]}
/>
</Suspense>
<Suspense fallback={<p>...loading</p>}>
<SectionSliderProductCard
category='all'
heading='HOT 신상'
produdtData={myData.result as ProductList[]}
/>
</Suspense>

{/* <SectionSliderProductCard
category='best'
Expand Down
7 changes: 2 additions & 5 deletions src/components/ai/Ai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function Ai() {
const formData = new FormData();
formData.append('img', selectedFile);

console.log('formData: ', formData.get('img'))
// console.log('formData: ', formData.get('img'))
try {
setLoading(true);
const res = await fetch(`https://gentledog-ai-new.duckdns.org/image_predict`, {
const res = await fetch(`https://gentledogai.duckdns.org/image_predict`, {
method: 'POST',
body: formData,
});
Expand All @@ -41,7 +41,6 @@ function Ai() {
});
const dogId = await res.json();

console.log('dogId: ', dogId);
if (dogId) {
const res = await fetch(`${process.env.BASE_API_URL}/api/v1/review/find-review-dogId`, {
method: 'POST',
Expand All @@ -54,7 +53,6 @@ function Ai() {
});
const productId = await res.json();

console.log('productId: ', productId);
if (productId) {
const res = await fetch(`${process.env.BASE_API_URL}/api/v1/product/ai-product-detail`, {
method: 'POST',
Expand All @@ -67,7 +65,6 @@ function Ai() {
});

const productDetail = await res.json();
console.log('productDetail: ', productDetail);

if (productDetail) {
localStorage.setItem('aiProductDetail', JSON.stringify(productDetail.result));
Expand Down

0 comments on commit f3a4e2c

Please sign in to comment.