inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

비전공자를 위한 진짜 입문 올인원 개발 부트캠프

결제하기 구현 - 2

soldout 부분 blur처리가 되지 않습니다

266

이한성

작성한 질문수 6

1

안녕하세요 그랩님

soldout이 1일때 blur 처리가 안돼서 질문 남깁니다

그냥 <div className="product-blur" />로 들어가면 블러 처리가 되는데

{product.soldout === 1 &&  <div className="product-blur" />} 로 작성하고 나면 soldout이 1인 상품에 블러처리가 되지 않습니다.

DB.Browser에서 확인해봐도 soldout부분은 1로 되어있는데 왜 그런걸까요?

web, server 코드 다 올려봅니다

다른 부분 확인해보셔야할데가 있다면 알려주시면 바로 올리겠습니다

항상 감사합니다

<div id="product-list">
{products.map(function (product, index) {
return (
<div className="product-card">
{product.soldout === 1 && <div className="product-blur" />}
<Link
style={{ color: "inherit" }}
className="product-link"
to={`/products/${product.id}`}
>

app.post("/purchase/:id", (req, res) => {
const { id } = req.params;
models.Product.update(
{
soldout: 1,
},
{
where: {
id,
},
}
)
.then((result) => {
res.send({
result: true,
});
})
.catch((error) => {
console.error(error);
res.status(500).send("에러가 발생했습니다");
});
});

react-native react HTML/CSS express tensorflow nodejs javascript 머신러닝 배워볼래요?

답변 5

4

그랩

괜찮습니다 ㅎㅎ 로그를 잘 찍어주셨네요!

현재 product에  soldout이 들어가있는 로그가 있나요? 현재 보여주신 로그에는 soldout을 보내주지 않고 있습니다.

아마 제가 봤을 때 서버쪽에서 GET /products 부분에 아래와 같이 attributes에 soldout이 추가되어야 합니다!

app.get("/products", (req, res) => {
models.Product.findAll({
order: [["createdAt", "DESC"]],
attributes: [
"id",
"name",
"price",
"createdAt",
"seller",
"imageUrl",
"soldout"
],
})

1

그랩

혹시 product-blur의 style은 어떻게 적용되어있나요~?

soldout이 잘 들어있다면 해당 컴포넌트는 잘 들어가는 게 맞을 것 같아요ㅎㅎ

0

이한성

안녕하세요 그랩님!

혹시 이걸 말씀하시는게 맞을까요ㅠ?

너무 몰라서 죄송합니다ㅠㅠㅠ

0

그랩

아 그러면  soldout 데이터를 확인해보는 게 빠르겠군요.

아래와 같이 product를 화면에 렌더링할 때 product 데이터를 로그로 남겨보시겠어요?

현재 문제가 되는 product의 로그를 캡쳐해서 보여주시면 확인이 가능할 것 같아요~!

<div id="product-list">

{products.map(function (product, index) {

 console.log(product)

 return (

0

이한성

point-blur 코드 올려봅니다.

.product-blur {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ffffffaa;
pointer-events: none;
}

그냥 <div className="product-blur" />로 들어가면 블러 처리가 잘 되는데

{product.soldout === 1 &&  <div className="product-blur" />} 로 작성하고 나면 블러가 안됩니다ㅠ

[해결]그랩님 답변 주세요.

0

190

2

그랩님의 답변을 기다립니다/102강 전반적인 에러

0

162

2

[그랩님께]101강 안드로이드 에러들(Key prop)해결방법 궁금합니다.

0

139

2

[재질문][그랩님 답변 부탁드립니다]101강

0

162

2

[그랩님 답변 부탁드립니다]101강 Axios 에러와 502 Bad Gateway 질문

0

118

2

Ngrok 설치 후 forwarding Url 에러

0

144

2

[그랩님께,Ngrok 악성코드 인식 해결방법]질문 드립니다.

0

251

2

Ngrok 설치 후 forwarding Url로 연결 불가

0

157

1

그랩님,[꼭] 답변 부탁드립니다.

0

76

1

[꼭][[꼭] 그랩님, 답변 부탁드립니다], Failed to load resource: the server responded with a status of 404 (Not Found) 상품 상세 페이지 질문입니다.

0

162

1

6강/7강 수업

0

56

1

그랩님, 상품 상세 페이지 에러와 의문점 질문드립니다.

0

105

2

그랩님, 해결되지 않은 에러 메시지 [꼭] 답변 부탁 드립니다.

0

148

2

[재 질문]Cannot read properties of undefined (reading 'map') TypeError: Cannot read properties of undefined (reading 'map') 에러 해결 어떻게 하나요?

0

94

1

Cannot read properties of undefined (reading 'map') TypeError: Cannot read properties of undefined (reading 'map') 에러 해결 어떻게 하나요?

0

134

2

일반적인 css 꾸미기에서 width와 height의 값?

0

98

2

Windows에서의 업로드 후 홈화면 상품이미지 오류 해결방법

0

204

1

그랩마켓 웹화면 구현하기 -2 질문입니다.

0

127

1

react에 반영이 되지 않습니다.

0

250

1

터미널 npm install -g create-react-app 작성 후 오류

0

430

1

create-react-app my app 실행 시 에러

0

358

2

포스트맨 질문

0

105

1

<꼭 답변 부탁 드립니다>그랩선생님, [컴포넌트 사용하기] 강의에서 질문 있습니다.

0

269

2

그랩선생님, 질문 답변 부탁 드립니다.vscode에서 npm install -g create-react-app 입력 후 에러 입니다.

0

492

2