Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion front/config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module.exports = merge(common, {
},
"sass-loader",
],
// use: ["style-loader", "css-loader", "sass-loader"],
},
],
},
Expand Down
16 changes: 8 additions & 8 deletions front/config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion front/src/api/Api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/comment/CommentInput.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/market/CreateMarketCard.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
6 changes: 0 additions & 6 deletions front/src/components/myPage/UserComment/UserComment.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
1 change: 0 additions & 1 deletion front/src/components/myPage/UserPost/UserPostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions front/src/components/myPage/UserPost/UserPostCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions front/src/pages/Market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,6 +32,7 @@ interface ShowCard {

const Market = () => {
const navigate = useNavigate();
const {LoginToHavePermission} = useUserStore();
const [page, setPage] = useState<number>(1);
const [marketCards, setMarketCards] = useState<ShowCard[]>([]);
const [hasNextPage, setHasNextPage] = useState<boolean>(false);
Expand Down Expand Up @@ -213,6 +216,7 @@ const Market = () => {
className={MarketStyle.writeBtnOutline}
sx={{ fontSize: 30 }}
onClick={() => {
LoginToHavePermission()
navigate("/createMarketCard");
}}
></EditIcon>
Expand Down
38 changes: 31 additions & 7 deletions front/src/store/Login.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { useNavigate } from "react-router-dom";
import create from "zustand";

const navigate = useNavigate();

interface User {
email: string;
name: string;
Expand All @@ -11,7 +14,7 @@ interface User {
type StateProps = {
user: User
setUser: (user: User) => void;
// setUserClear: () => void;
LoginToHavePermission: () => void;
}


Expand All @@ -27,13 +30,34 @@ const useUserStore = create<StateProps>((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("로그인이 필요한 기능입니다.</")
// }

// const isLoginStore = (set, get) => ({
// 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;

6 changes: 0 additions & 6 deletions front/src/styles/RegisterPage/Register.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
// `}