Commit 20025a25 authored by 박상호's avatar 박상호 🎼
Browse files

good

parent bbd71444
...@@ -9,11 +9,13 @@ function MainNav() { ...@@ -9,11 +9,13 @@ function MainNav() {
return ( return (
<Navbar sticky="top" style={{ background: "#CDC5C2" }}> <Navbar sticky="top" style={{ background: "#CDC5C2" }}>
<Navbar.Brand href="/home" className="text-light"> <Navbar.Brand href="/home" className="text-light">
<img alt="로고" src="/icon/footprint.svg" width="24" height="24" /> <img alt="로고" src="/icon/footprint.svg" width="18" height="18" />
{' '}KU# {' '}KU#
</Navbar.Brand> </Navbar.Brand>
<Nav className="ml-auto"> <Nav className="ml-auto d-flex align-items-center">
{user ? <> <Nav.Link className="text-light" onClick={() => handleLogout()}>Logout</Nav.Link> {user ?
<>
<Nav.Link className="text-light" onClick={() => handleLogout()}>Logout</Nav.Link>
<Nav.Link className="text-light" href="/account"> Mypage </Nav.Link> <Nav.Link className="text-light" href="/account"> Mypage </Nav.Link>
<Nav.Link href="/shoppingcart"> <Nav.Link href="/shoppingcart">
<img alt="카트" src="/icon/cart.svg" width="30" height="30" /> <img alt="카트" src="/icon/cart.svg" width="30" height="30" />
......
...@@ -18,6 +18,7 @@ function Account() { ...@@ -18,6 +18,7 @@ function Account() {
const userId = isAuthenticated() const userId = isAuthenticated()
const [ordered, setOrdered] = useState('') const [ordered, setOrdered] = useState('')
async function getUsername(user) { async function getUsername(user) {
// console.log("tlg") // console.log("tlg")
try { try {
...@@ -94,6 +95,7 @@ function Account() { ...@@ -94,6 +95,7 @@ function Account() {
} }
} }
return ( return (
<Container className="px-3"> <Container className="px-3">
<style type="text/css"> <style type="text/css">
......
...@@ -185,15 +185,15 @@ function ProductsRegist() { ...@@ -185,15 +185,15 @@ function ProductsRegist() {
<Form.Group> <Form.Group>
<Form.Label>분류</Form.Label> <Form.Label>분류</Form.Label>
<Row> <Row>
<Col md={4}> <Col md={4} className="mb-1">
<Form.Control as="select" name="main_category" onChange={handleCategory} disabled={product["sub_category"].length > 0}> <Form.Control as="select" name="main_category" onChange={handleCategory} disabled={product["sub_category"].length > 0} >
<option value="" >상위분류</option> <option value="" >상위분류</option>
{categories[0].map((main) => ( {categories[0].map((main) => (
<option value={main}>{main}</option> <option value={main}>{main}</option>
))} ))}
</Form.Control> </Form.Control>
</Col> </Col>
<Col md={6}> <Col md={6} className="mb-2">
<Form.Control as="select" ref={selectRef} name="sub_category" onChange={handleCategory}> <Form.Control as="select" ref={selectRef} name="sub_category" onChange={handleCategory}>
<option value="" >하위분류</option> <option value="" >하위분류</option>
{(categoryNum === '') ? '' : (categories[1][categoryNum].map((sub) => ( {(categoryNum === '') ? '' : (categories[1][categoryNum].map((sub) => (
...@@ -209,7 +209,7 @@ function ProductsRegist() { ...@@ -209,7 +209,7 @@ function ProductsRegist() {
</Form.Group> </Form.Group>
<Form.Group> <Form.Group>
<Form.Label>사이즈</Form.Label> <Form.Label>사이즈</Form.Label>
<Row> <Row className="px-3">
<Col> <Col>
<Form.Check type="checkbox" name="sizes" label="210" value="210" onChange={handleCheckBox} /> <Form.Check type="checkbox" name="sizes" label="210" value="210" onChange={handleCheckBox} />
<Form.Check type="checkbox" name="sizes" label="215" value="215" onChange={handleCheckBox} /> <Form.Check type="checkbox" name="sizes" label="215" value="215" onChange={handleCheckBox} />
...@@ -238,10 +238,10 @@ function ProductsRegist() { ...@@ -238,10 +238,10 @@ function ProductsRegist() {
<Form.Group> <Form.Group>
<Form.Label>색상</Form.Label> <Form.Label>색상</Form.Label>
<Row> <Row>
<Col md={10}> <Col md={9} xs={9} className="pr-1">
<Form.Control as="input" ref={colorRef} name="colors" placeholder="색상" onChange={handleColor} /> <Form.Control as="input" ref={colorRef} name="colors" placeholder="색상" onChange={handleColor} />
</Col> </Col>
<Col> <Col className="pl-1">
<Button className="float-right" style={{ background: '#91877F', borderColor: '#91877F' }} onClick={addColor}>추가</Button> <Button className="float-right" style={{ background: '#91877F', borderColor: '#91877F' }} onClick={addColor}>추가</Button>
</Col> </Col>
</Row> </Row>
......
...@@ -58,38 +58,11 @@ function ProductsList({ match }) { ...@@ -58,38 +58,11 @@ function ProductsList({ match }) {
console.log("first test!!!!!!!!") console.log("first test!!!!!!!!")
const response = await axios.get(`/api/product/getproduct/sub/${subname}`) const response = await axios.get(`/api/product/getproduct/sub/${subname}`)
console.log("subname response data=", response.data) console.log("subname response data=", response.data)
setProductlist([response.data]) setProductlist(response.data)
} catch (error) { } catch (error) {
console.log("error22") console.log("error22")
} }
// const listvalue = Object.values(productlist)
// for (let i = 0; i < listvalue.length; i++) {
// const list = listvalue[i].sub_category[0]
// console.log("list=", list)
// console.log("include=", subcategory.includes("LONG DRESS"))
// if (listvalue[i].sub_category[0] === subcategory[0]) {
// console.log("yes")
// }
// else {
// console.log("no")
// }
} }
// if (productlist.sub_category) {
// }
// console.log("list", list)
// for (let i = 0; i < list.length; i++) {
// if (response.data[i] === "subcategory") {
// console.log("handlesub=", response.data[i].sub_category)
// }
// else {
// console.log("handlesub=2 ", response.data[i].sub_category)
// }
// }
// }
return ( return (
<div> <div>
......
...@@ -15,6 +15,7 @@ export async function handleLogout() { ...@@ -15,6 +15,7 @@ export async function handleLogout() {
export function isAuthenticated() { export function isAuthenticated() {
const userId = localStorage.getItem('id') const userId = localStorage.getItem('id')
// console.log("suer ID =", userId)
if (userId) { if (userId) {
return userId return userId
} else { } else {
......
...@@ -84,15 +84,13 @@ const categoryId = async (req, res, next, category) => { ...@@ -84,15 +84,13 @@ const categoryId = async (req, res, next, category) => {
const subcategoryId = async (req, res, next, subname) => { const subcategoryId = async (req, res, next, subname) => {
try { try {
console.log("Please===>>>", subname) console.log("Please===>>>", subname)
const findSubname = await Product.findOne({ sub_category: subname }) const findSubname = await Product.find({ sub_category: subname })
// const findSubname = await Product.find({ sub_category: { $elemMatch: { subname: req.subname }}})
console.log("findSubname111=", findSubname) console.log("findSubname111=", findSubname)
// const onlySub = findSubname.sub_category // const onlySub = findSubname.sub_category
// console.log(";;", onlySub) // console.log(";;", onlySub)
// console.log(".", Object.values(onlySub)) // console.log(".", Object.values(onlySub))
if (!findSubname) { if (!findSubname) {
console.log("ㅏㅁㄴ우하ㅣㅜㅁㄴ어ㅏㅣ훔ㄴ어ㅏㅣ휴")
const findSubname = { const findSubname = {
_id: 'nothing', _id: 'nothing',
pro_name: '상품준비중', pro_name: '상품준비중',
...@@ -103,12 +101,10 @@ const subcategoryId = async (req, res, next, subname) => { ...@@ -103,12 +101,10 @@ const subcategoryId = async (req, res, next, subname) => {
res.send(findSubname) res.send(findSubname)
} }
res.send(findSubname) res.send(findSubname)
// next()
} catch (error) { } catch (error) {
res.send('상품을 불러오지 못했습니다.') res.send('상품을 불러오지 못했습니다.')
} }
} }
//https://docs.mongodb.com/manual/reference/operator/projection/elemMatch/index.html
const plusPurchase = async (req, res) => { const plusPurchase = async (req, res) => {
const { products } = req.body const { products } = req.body
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment