λν
μΌ νμ΄μ§μμ μ₯λ°κ΅¬λ λ΄κΈ° λ²νΌμ λλ₯΄λ©΄ λ°±μλμ λ°μ΄ν°λ₯Ό 보λ΄μ£Όλ ν¨μλ₯Ό μμ±ν΄λ³΄λ € νλ€. λ°±μλμ 보λ΄μΌ ν  λ°μ΄ν°λ μν idμ μλμ΄λ€. κ°κ²©μ΄λ μν κ΄λ ¨ μ λ³΄λ product_idλ§ λ³΄λ΄μ€λ λ€ μ²λ¦¬κ° κ°λ₯νκ²λ νλ€. 
const handleAddItemToCart = () => {
    fetch(`${API.USER}/cart`, {
      method: 'POST',
      body: JSON.stringify({
        product_id: detailContents.id,
        quantity: productAmount,
      }),
    })
      .then(response => response.json())
      .then(result => {
        if (result.MESSAGE === 'SUCCESS') {
          alert('μ₯λ°κ΅¬λμ λ΄κ²Όμ΅λλ€.');
          window.location.reload();
      });
  };
const handleAddItemToCart = () => {
    fetch(`${API.USER}/cart`, {
      method: 'POST',
      headers: {
        Authorization: localStorage.getItem('token'),
      },
      body: JSON.stringify({
        product_id: detailContents.id,
        quantity: productAmount,
      }),
    })
      .then(response => response.json())
      .then(result => {
        if (result.MESSAGE === 'SUCCESS') {
          alert('μ₯λ°κ΅¬λμ λ΄κ²Όμ΅λλ€.');
          window.location.reload();
        } else if (result.MESSAGE === 'ITEM_ALREADY_EXIST')
          alert('μ΄λ―Έ μ₯λ°κ΅¬λμ μλ μνμ
λλ€.');
        else if (result.ERROR === 'INVALID_TOKEN')
          alert('λ‘κ·ΈμΈ ν μ₯λ°κ΅¬λμ λ΄μμ£ΌμΈμ.');
      });
  };
headersμ ν ν°μ μ€μ΄μ£Όκ³ , bodyμ μ°λ¦¬κ° λ°μ΄ν°λ₯Ό 보λ΄μ€ product_idμ quantityλ₯Ό λ΄μμ€λ€. μ΄νμ, μλ΅μ λ°κ³  κ·Έμ λν κ°κ°μ λ©μμ§λ₯Ό λ£μ΄μ€λ€. μμ ν μ½λμμ λμ¬κ²¨ λ³Ό λΆλΆμ headersμ΄λ€.  λ‘κ·ΈμΈμ ν μ μ λ€λ§ μ₯λ°κ΅¬λμ μνμ λ΄μ μ μλλ‘ νλλ°, κ·Έλ¬λ €λ©΄ headersμ ν ν°μ΄ μμ΄μΌ κ°λ₯νλ€. μμ  μ μλ μ΄ λΆλΆμ κ°κ³Όνκ³  λμ΄κ°μλ€. 
<Button
   handleClick={handleAddItemToCart}
   format="bigger"
   type="button"
   title={`μ₯λ°κ΅¬λμ λ΄κΈ° (${Number(
   productAmount * price?.split('.')[0]
   ).toLocaleString()} μ)`}
/>
μμ μμ±νλhandleAddItemToCartν¨μλ₯Ό μ₯λ°κ΅¬λ λ΄κΈ° λ²νΌμ μΆκ°ν΄μ£Όλ©΄ λλ€.