diff --git a/front/config/webpack.dev.js b/front/config/webpack.dev.js index afd5f23..16bf589 100644 --- a/front/config/webpack.dev.js +++ b/front/config/webpack.dev.js @@ -36,7 +36,6 @@ module.exports = merge(common, { }, "sass-loader", ], - // use: ["style-loader", "css-loader", "sass-loader"], }, ], }, diff --git a/front/config/webpack.prod.js b/front/config/webpack.prod.js index 5040ebd..3c6483a 100644 --- a/front/config/webpack.prod.js +++ b/front/config/webpack.prod.js @@ -9,14 +9,14 @@ const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); module.exports = merge(common, { mode: "production", devtool: "cheap-module-source-map", - devServer: { - open: false, - hot: true, - compress: true, - port: 8081, - historyApiFallback: true, - liveReload: true, - }, + // devServer: { + // open: false, + // hot: true, + // compress: true, + // port: 8081, + // historyApiFallback: true, + // liveReload: true, + // }, output: { filename: "[name].[contenthash].js", path: path.resolve(__dirname, "../dist"), diff --git a/front/src/api/Api.tsx b/front/src/api/Api.tsx index ab1c097..6be8d66 100644 --- a/front/src/api/Api.tsx +++ b/front/src/api/Api.tsx @@ -2,7 +2,7 @@ import axios, { AxiosError } from "axios"; const backendPortNumber = "5000"; -const serverUrl = "http://34.64.178.176:" + backendPortNumber + "/"; +const serverUrl = "http://localhost:" + backendPortNumber + "/"; async function get(endpoint: string, params?: string | null) { console.log(`GET 요청 ${serverUrl + endpoint}`); diff --git a/front/src/components/comment/CommentInput.tsx b/front/src/components/comment/CommentInput.tsx index 5fb0e4c..c2f61c4 100644 --- a/front/src/components/comment/CommentInput.tsx +++ b/front/src/components/comment/CommentInput.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState } from "react"; import { RoundBtn, black, white } from "../buttons/BasicBtn"; import Checkbox from "@mui/joy/Checkbox"; import * as Api from "../../api/Api"; diff --git a/front/src/components/market/CreateMarketCard.tsx b/front/src/components/market/CreateMarketCard.tsx index c4f9096..c01df0d 100644 --- a/front/src/components/market/CreateMarketCard.tsx +++ b/front/src/components/market/CreateMarketCard.tsx @@ -1,4 +1,4 @@ -import React, { RefObject, useEffect, useRef, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { useNavigate } from "react-router-dom"; import * as Api from "../../api/Api"; import Create from "../../styles/showOffPage/CreateShowCard.module.css"; diff --git a/front/src/components/myPage/UserComment/UserComment.tsx b/front/src/components/myPage/UserComment/UserComment.tsx index de07723..68cf980 100644 --- a/front/src/components/myPage/UserComment/UserComment.tsx +++ b/front/src/components/myPage/UserComment/UserComment.tsx @@ -1,12 +1,6 @@ -import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; -import * as CommunityCardInterface from "../../../store/CommunityShowCard"; -import Card from "../../../styles/showOffPage/ShowCard.module.css"; import Avatar from "@mui/material/Avatar"; import useUserStore from "../../../store/Login"; -import Stack from "@mui/material/Stack"; -import { SquareBtn, white, black } from "../../buttons/BasicBtn"; -import * as Api from "../../../api/Api"; import { Props } from "./UserComments"; import { TopNavStore, pageStore } from "@/store/MyPage"; import Cmt from "../../../styles/Comment.module.css"; diff --git a/front/src/components/myPage/UserPost/UserPostCard.tsx b/front/src/components/myPage/UserPost/UserPostCard.tsx index d3deb18..9134061 100644 --- a/front/src/components/myPage/UserPost/UserPostCard.tsx +++ b/front/src/components/myPage/UserPost/UserPostCard.tsx @@ -5,7 +5,6 @@ import useUserStore from "../../../store/Login"; import Stack from "@mui/material/Stack"; import { SquareBtn, white, black } from "../../buttons/BasicBtn"; import * as Api from "../../../api/Api"; -// import { props } from "./UserPostCards"; import { TopNavStore, pageStore } from "@/store/MyPage"; interface ShowCard { diff --git a/front/src/components/myPage/UserPost/UserPostCards.tsx b/front/src/components/myPage/UserPost/UserPostCards.tsx index 05fd21e..fc57532 100644 --- a/front/src/components/myPage/UserPost/UserPostCards.tsx +++ b/front/src/components/myPage/UserPost/UserPostCards.tsx @@ -8,6 +8,7 @@ import UserMarketCard from "./UserMarketCard"; import CardListStyle from "../../../styles/showOffPage/CardList.module.css"; import { TopNavStore, pageStore } from "@/store/MyPage"; import ShowCard from "../../market/MarketCard"; + export interface ShowCard { author: string; contents: string; diff --git a/front/src/pages/Market.tsx b/front/src/pages/Market.tsx index 5f1e396..6fe8ddc 100644 --- a/front/src/pages/Market.tsx +++ b/front/src/pages/Market.tsx @@ -7,6 +7,8 @@ import * as Api from "../api/Api"; import MarketCard from "../components/market/MarketCard"; import CardListStyle from "../styles/showOffPage/CardList.module.css"; import useDebounce from "@/useDebounce"; +import useUserStore from "../store/Login"; + interface Author { imageUrl: string; name: string; @@ -30,6 +32,7 @@ interface ShowCard { const Market = () => { const navigate = useNavigate(); + const {LoginToHavePermission} = useUserStore(); const [page, setPage] = useState(1); const [marketCards, setMarketCards] = useState([]); const [hasNextPage, setHasNextPage] = useState(false); @@ -213,6 +216,7 @@ const Market = () => { className={MarketStyle.writeBtnOutline} sx={{ fontSize: 30 }} onClick={() => { + LoginToHavePermission() navigate("/createMarketCard"); }} > diff --git a/front/src/store/Login.ts b/front/src/store/Login.ts index e8cf54f..ee54d7b 100644 --- a/front/src/store/Login.ts +++ b/front/src/store/Login.ts @@ -1,5 +1,8 @@ +import { useNavigate } from "react-router-dom"; import create from "zustand"; +const navigate = useNavigate(); + interface User { email: string; name: string; @@ -11,7 +14,7 @@ interface User { type StateProps = { user: User setUser: (user: User) => void; - // setUserClear: () => void; + LoginToHavePermission: () => void; } @@ -27,13 +30,34 @@ const useUserStore = create((set) => ({ set((state) => ({ ...state, user - })) - // setUserClear: () => set({user : {email: "", - // name: "", - // userId: "", - // imageUrl: "", - // accessToken: ""}}) + })), + LoginToHavePermission: (get) => { + const user = get(useUserStore.user) + if (user.email == ""){ + if (confirm("로그인이 필요한 기능입니다. \n 로그인하러 가시겠습니까?")){ + navigate("/login") + } + } + } })); +// const isLoginStore = { +// confirm("로그인이 필요한 기능입니다. ({ +// isLogin: () => +// set( +// (prev) => ({ fishes: prev.fishes > 1 ? prev.fishes - 1 : 0 }), +// false, +// 'bear/eatFish' +// ), +// }) + +// const isLogin = () => (get) => { +// const user = get(useUserStore.user) +// return user. +// } + export default useUserStore; diff --git a/front/src/styles/RegisterPage/Register.styled.ts b/front/src/styles/RegisterPage/Register.styled.ts index 5091c35..a6f151d 100644 --- a/front/src/styles/RegisterPage/Register.styled.ts +++ b/front/src/styles/RegisterPage/Register.styled.ts @@ -109,9 +109,3 @@ export const NotifyNotValid = styled.div` export const NotifyValid = styled(NotifyNotValid)` color: green; `; - -// ${(props) => -// props.primary && //primary 가 존재할 경우 -// css` -// border: red solid 0.15rem; -// `}