diff --git a/client/package-lock.json b/client/package-lock.json index 57c573795..47862a988 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -19,6 +19,7 @@ "@testing-library/user-event": "^13.5.0", "aws-sdk": "^2.1130.0", "axios": "^0.26.1", + "qs": "^6.10.3", "react": "^18.0.0", "react-aws-s3": "^1.5.0", "react-dom": "^18.0.0", @@ -15062,14 +15063,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, - "node_modules/react-intersection-observer": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.1.0.tgz", - "integrity": "sha512-XSDWQGzgJ4/B4eW39+qa3S+uc4Gb+m6lxXR54m/uD5lqeL5sLrgYdntbjl4BlTYAblgUhz+JB5obINhZaD+c0Q==", - "peerDependencies": { - "react": "^15.0.0 || ^16.0.0 || ^17.0.0|| ^18.0.0" - } - }, "node_modules/react-is": { "version": "18.0.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", @@ -32159,12 +32152,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, - "react-intersection-observer": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.1.0.tgz", - "integrity": "sha512-XSDWQGzgJ4/B4eW39+qa3S+uc4Gb+m6lxXR54m/uD5lqeL5sLrgYdntbjl4BlTYAblgUhz+JB5obINhZaD+c0Q==", - "requires": {} - }, "react-is": { "version": "18.0.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.0.0.tgz", diff --git a/client/package.json b/client/package.json index ddb1a0633..45a50a380 100644 --- a/client/package.json +++ b/client/package.json @@ -14,6 +14,7 @@ "@testing-library/user-event": "^13.5.0", "aws-sdk": "^2.1130.0", "axios": "^0.26.1", + "qs": "^6.10.3", "react": "^18.0.0", "react-aws-s3": "^1.5.0", "react-dom": "^18.0.0", diff --git a/client/src/component/MypageCompo/FreeWriting.js b/client/src/component/MypageCompo/FreeWriting.js index 396649201..d3a571af0 100644 --- a/client/src/component/MypageCompo/FreeWriting.js +++ b/client/src/component/MypageCompo/FreeWriting.js @@ -80,6 +80,13 @@ const WritingContainer = styled.div` } `; +const Btn = styled.button` + &.need { + display: none; + color: red; + } +`; + function Writing() { const { id, accToken } = useSelector(selectUserInfo); const config = { @@ -162,10 +169,11 @@ function Writing() { ) .then((res) => { setTextValues({ - title: null, - content: null, + title: '', + content: '', }); - setSelectedFile(null); + setSelectedFile(''); + fileInput.current.value = ''; if (res.data.infoId) alert('글이 등록되었습니다.'); }) .catch((err) => { @@ -210,7 +218,7 @@ function Writing() { rows="1" cols="55" placeholder="제목" - maxlength="100" + maxlength="100" //삭제? value={textValues.title} onChange={(e) => setTextValues({ ...textValues, title: e.target.value }) @@ -232,7 +240,9 @@ function Writing() { onChange={handleInputChange} ref={fileInput} /> - + + 파일 취소 +
{ axios - .get(`${process.env.REACT_APP_SERVER_DEV_URL}/users/${id}`, getConfig) + .get( + `${process.env.REACT_APP_SERVER_DEV_URL}/users/userInfo/${id}`, + getConfig, + ) .then((res) => { const { user } = res.data; if (user) { @@ -278,26 +281,20 @@ function UserInfo() { myBucket .putObject(params, (err, data) => { //서버로 profileImg 값 보내주기.(일단 임시로 작성) - // axios - // .post( - // `${process.env.REACT_APP_SERVER_DEV_URL}/users/${id}/img`, - // { profileImg: fileName }, - // postConfig, - // ) - // .then((res) => { - // dispatch( - // updateState({ - // profileImg: fileName, - // }), - // ); - // }) - // .catch((err) => alert('파일업로드 주소가 서버에 반영 안 됨.')); - //아래 코드는 서버랑 연동되면 삭제 - dispatch( - updateState({ - profileImg: fileName, - }), - ); + axios + .post( + `${process.env.REACT_APP_SERVER_DEV_URL}/users/${id}/img`, + { profileImg: fileName }, + postConfig, + ) + .then((res) => { + dispatch( + updateState({ + profileImg: fileName, + }), + ); + }) + .catch((err) => alert('파일업로드 주소가 서버에 반영 안 됨.')); }) .on('httpUploadProgress', (evt) => { dispatch( diff --git a/client/src/component/Search.js b/client/src/component/Search.js index 72d621e9c..fe51dfab3 100644 --- a/client/src/component/Search.js +++ b/client/src/component/Search.js @@ -3,8 +3,8 @@ import React, { useRef, useState, useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons'; -import { selectSearch, updateSearch } from '../store/slices/search'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; +import QueryString from 'qs'; const boxShadow = '0 4px 6px rgb(32 33 36 / 28%)'; // const activeBorderRadius = '1rem 1rem 0 0'; @@ -83,32 +83,9 @@ export const InputContainer = styled.div` } */ `; -function SelectBox({ items, className, role }) { - const dispatch = useDispatch(); - const { selectBox1, selectBox2 } = useSelector(selectSearch); - - const handleSelect = (e) => { - if (role === 'first') { - dispatch( - updateSearch({ - selectBox1: e.target.value, - }), - ); - } else { - dispatch( - updateSearch({ - selectBox2: e.target.value, - }), - ); - } - }; - +function SelectBox({ items, className, selectVal, handleSelect }) { return ( - {items.map(([name, value], i) => (