From 435b026350e34c2cfce5026ad985bc0fce6961b5 Mon Sep 17 00:00:00 2001 From: lth01 Date: Fri, 10 May 2024 15:57:06 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20User=20=ED=94=84=EB=A1=A0=ED=8A=B8=20?= =?UTF-8?q?=EB=B0=B1=EC=97=94=EB=93=9C=20=EC=97=B0=EB=8F=99=20=EC=9E=91?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. MyPage 탭 제외 기능 개발 완료 2. user정보 fetch, save 기능 개발 3. Avatar Image 보이도록 로직 개발 Pending: #130 --- src/front/src/App.jsx | 5 +++++ src/front/src/index.jsx | 7 +++++- src/front/src/routes/Main.jsx | 10 ++++----- src/front/src/routes/Mypage.jsx | 35 ++++++++++++++++++++++++++---- src/front/src/routes/Resign.jsx | 38 +++++++++++++++++++++++++-------- src/front/src/utils/API.js | 7 ++++++ 6 files changed, 83 insertions(+), 19 deletions(-) diff --git a/src/front/src/App.jsx b/src/front/src/App.jsx index 4bc9394..2f3c887 100644 --- a/src/front/src/App.jsx +++ b/src/front/src/App.jsx @@ -9,6 +9,7 @@ import ChatBox from "./components/ChatBox"; import MyPage from "./routes/Mypage"; import UserPage from "./routes/UserPage"; import PasswordFind from "./routes/PasswordFind"; +import Resign from "./routes/Resign"; @@ -33,6 +34,10 @@ const router = createBrowserRouter([ path: "/chat", element: }, + { + path: "/resign", + element: + }, { path: "/mypage", element: diff --git a/src/front/src/index.jsx b/src/front/src/index.jsx index f583a95..a81401c 100644 --- a/src/front/src/index.jsx +++ b/src/front/src/index.jsx @@ -2,17 +2,22 @@ import { useState, createContext, useEffect } from 'react'; const GlobalContext = createContext({ isLogin: false, - setLogin: () =>{} + userInfo: {}, + setLogin: () =>{}, + setUserInfo: () =>{} }); const ContextProvider = ({children}) =>{ // 생성자 const [isLogin, setLogin] = useState(false); + const [userInfo, setUserInfo] = useState({}); return ( {children} diff --git a/src/front/src/routes/Main.jsx b/src/front/src/routes/Main.jsx index 3d5e0f8..4482d2f 100644 --- a/src/front/src/routes/Main.jsx +++ b/src/front/src/routes/Main.jsx @@ -28,12 +28,12 @@ const Main = () =>{
로그인 된거
: (
-

About Us

+

1inked 1n

-

1

-

2

-

3

-

4

+

해외 취업 고민하는 우리

+

1inked 1n에서

+

자소서 첨삭부터

+

전문가 매칭까지

diff --git a/src/front/src/routes/Mypage.jsx b/src/front/src/routes/Mypage.jsx index 6b51c2e..f6700e1 100644 --- a/src/front/src/routes/Mypage.jsx +++ b/src/front/src/routes/Mypage.jsx @@ -1,6 +1,6 @@ import Header from "@/components/Layout/Header.jsx"; import {Avatar, AvatarImage, AvatarFallback} from "@/components/ui/avatar.jsx"; -import {useState} from "react"; +import {useEffect, useState} from "react"; import {Link} from "react-router-dom"; import {Tabs, TabsList, TabsTrigger, TabsContent} from "@/components/ui/tabs"; import { Input } from "@/components/ui/input"; @@ -9,6 +9,8 @@ import { Button } from "@/components/ui/button"; import FollowInfo from "@/components/FollowInfo"; import MyResumes from "@/components/MyResumes"; import { anchorScrollCallback } from "@/utils/common"; +import { saveProfileReqParam } from "@/utils/Parameter"; +import { fetchUserProfile, saveProfile } from "@/utils/API"; const MyPage = () => { //Mypage, UserPage는 유저 정보를 통해 pageOwner인지 판단한 후 구별이 가능 @@ -23,11 +25,36 @@ const MyPage = () => { const [location, setLocation] = useState('Location'); const [description, setDescription] = useState('Description'); const [username, setUsername] = useState('Username'); + const [file, setFile] = useState(null); + + useEffect(() =>{ + fetchUserProfile("dlxogml11235@naver.com") + .then(async (userInfo) => { + setUsername(userInfo.realName); + setIdentity(userInfo.identity); + setLocation(userInfo.location); + setDescription(userInfo.description); + + //user Profile image 설정 + setProfilePic(`data:image/png;base64,${userInfo.image}`); + }); + },[]); const toggleEditing = () => { setEditing(!editing); }; + //프로필 변경 사항 저장 API + const doSaveProfile = () =>{ + const reqParam = saveProfileReqParam("dlxogml11235@naver.com", identity, location, description, file); + + saveProfile(reqParam) + .then((response) => { + console.log(response); + toggleEditing(); + }); + } + const handleProfilePicChange = (event) => { const file = event.target.files[0]; const reader = new FileReader(); @@ -53,7 +80,7 @@ const MyPage = () => { {username}
비밀번호 변경 - 회원 탈퇴 + 회원 탈퇴
@@ -63,8 +90,8 @@ const MyPage = () => { setIdentity(e.target.value)}/> setLocation(e.target.value)}/>