From 6c787942ae814ba5f24585f0fc1f1aaf5469ff74 Mon Sep 17 00:00:00 2001 From: nonon Date: Fri, 15 Dec 2023 16:23:22 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Chore:=20yup=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 40 +++++++++++++++++++++++++++++++++++++++- package.json | 3 ++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 585ca09..b187bed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,8 @@ "recoil": "^0.7.7", "styled-components": "^6.1.1", "typescript": "^4.9.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "yup": "^1.3.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -14332,6 +14333,11 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/property-expr": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.6.tgz", + "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==" + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -16515,6 +16521,11 @@ "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" }, + "node_modules/tiny-case": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-case/-/tiny-case-1.0.3.tgz", + "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -16547,6 +16558,11 @@ "node": ">=0.6" } }, + "node_modules/toposort": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", + "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" + }, "node_modules/tough-cookie": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", @@ -17952,6 +17968,28 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/yup": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/yup/-/yup-1.3.3.tgz", + "integrity": "sha512-v8QwZSsHH2K3/G9WSkp6mZKO+hugKT1EmnMqLNUcfu51HU9MDyhlETT/JgtzprnrnQHPWsjc6MUDMBp/l9fNnw==", + "dependencies": { + "property-expr": "^2.0.5", + "tiny-case": "^1.0.3", + "toposort": "^2.0.2", + "type-fest": "^2.19.0" + } + }, + "node_modules/yup/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index a82ac2b..2ff0f72 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "recoil": "^0.7.7", "styled-components": "^6.1.1", "typescript": "^4.9.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "yup": "^1.3.3" }, "scripts": { "start": "react-scripts start", From 84d00f1cc90557cf4be39190fe6b8c1d527664e0 Mon Sep 17 00:00:00 2001 From: nonon Date: Fri, 15 Dec 2023 19:41:06 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Chore:=20react-query=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EC=82=AD=EC=A0=9C,=20@tanstack/react-query=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 120 ++++++++++------------------------------------ package.json | 2 +- src/index.tsx | 2 +- 3 files changed, 27 insertions(+), 97 deletions(-) diff --git a/package-lock.json b/package-lock.json index b187bed..91ba7e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "poten_fe", "version": "0.1.0", "dependencies": { + "@tanstack/react-query": "^5.13.4", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -19,7 +20,6 @@ "dayjs": "^1.11.10", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-query": "^3.39.3", "react-router-dom": "^6.20.1", "react-scripts": "5.0.1", "recoil": "^0.7.7", @@ -3598,6 +3598,30 @@ "url": "https://github.com/sponsors/gregberge" } }, + "node_modules/@tanstack/query-core": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.13.4.tgz", + "integrity": "sha512-8+rJucXvC/xlr4OrxHhEIob/cTlbT4fgmz1VsvB0D12FRStKaXeLORNGcOhSAynRd2NL74SV/Qq0IIb4DedLcA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.13.4.tgz", + "integrity": "sha512-3HjvkFFriEQwffUXtKHPiwkfFXUGbs46YATTzzyK1+Pw6Ekd3kwzS50e45qdamWuEXmXxyo5S1zp534LdFG0Rw==", + "dependencies": { + "@tanstack/query-core": "5.13.4" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18.0.0" + } + }, "node_modules/@testing-library/dom": { "version": "9.3.3", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.3.tgz", @@ -5452,14 +5476,6 @@ "node": ">= 8.0.0" } }, - "node_modules/big-integer": { - "version": "1.6.52", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", - "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", - "engines": { - "node": ">=0.6" - } - }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -5572,21 +5588,6 @@ "node": ">=8" } }, - "node_modules/broadcast-channel": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/broadcast-channel/-/broadcast-channel-3.7.0.tgz", - "integrity": "sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "detect-node": "^2.1.0", - "js-sha3": "0.8.0", - "microseconds": "0.2.0", - "nano-time": "1.0.0", - "oblivious-set": "1.0.0", - "rimraf": "3.0.2", - "unload": "2.2.0" - } - }, "node_modules/browser-process-hrtime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", @@ -11726,11 +11727,6 @@ "jiti": "bin/jiti.js" } }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -12123,15 +12119,6 @@ "tmpl": "1.0.5" } }, - "node_modules/match-sorter": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-6.3.1.tgz", - "integrity": "sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==", - "dependencies": { - "@babel/runtime": "^7.12.5", - "remove-accents": "0.4.2" - } - }, "node_modules/mdn-data": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz", @@ -12194,11 +12181,6 @@ "node": ">=8.6" } }, - "node_modules/microseconds": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/microseconds/-/microseconds-0.2.0.tgz", - "integrity": "sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==" - }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -12374,14 +12356,6 @@ "thenify-all": "^1.0.0" } }, - "node_modules/nano-time": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/nano-time/-/nano-time-1.0.0.tgz", - "integrity": "sha512-flnngywOoQ0lLQOTRNexn2gGSNuM9bKj9RZAWSzhQ+UJYaAFG9bac4DW9VHjUAzrOaIcajHybCTHe/bkvozQqA==", - "dependencies": { - "big-integer": "^1.6.16" - } - }, "node_modules/nanoid": { "version": "3.3.7", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", @@ -12653,11 +12627,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/oblivious-set": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/oblivious-set/-/oblivious-set-1.0.0.tgz", - "integrity": "sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw==" - }, "node_modules/obuf": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", @@ -14651,31 +14620,6 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, - "node_modules/react-query": { - "version": "3.39.3", - "resolved": "https://registry.npmjs.org/react-query/-/react-query-3.39.3.tgz", - "integrity": "sha512-nLfLz7GiohKTJDuT4us4X3h/8unOh+00MLb2yJoGTPjxKs2bc1iDhkNx2bd5MKklXnOD3NrVZ+J2UXujA5In4g==", - "dependencies": { - "@babel/runtime": "^7.5.5", - "broadcast-channel": "^3.4.1", - "match-sorter": "^6.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, "node_modules/react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -14972,11 +14916,6 @@ "node": ">= 0.10" } }, - "node_modules/remove-accents": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", - "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==" - }, "node_modules/renderkid": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz", @@ -16857,15 +16796,6 @@ "node": ">= 10.0.0" } }, - "node_modules/unload": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/unload/-/unload-2.2.0.tgz", - "integrity": "sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==", - "dependencies": { - "@babel/runtime": "^7.6.2", - "detect-node": "^2.0.4" - } - }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/package.json b/package.json index 2ff0f72..12dcde1 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@tanstack/react-query": "^5.13.4", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -14,7 +15,6 @@ "dayjs": "^1.11.10", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-query": "^3.39.3", "react-router-dom": "^6.20.1", "react-scripts": "5.0.1", "recoil": "^0.7.7", diff --git a/src/index.tsx b/src/index.tsx index ff390b1..fbbd824 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,7 +4,7 @@ import './index.css'; import reportWebVitals from './reportWebVitals'; import { RouterProvider } from 'react-router-dom'; import { router } from './routes/Router'; -import { QueryClient, QueryClientProvider } from 'react-query'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { RecoilRoot } from 'recoil'; import { GlobalStyle } from 'styles/globalStyles'; From 0c6ad3a07541060708e2dca752b3fbd5fed9cf7e Mon Sep 17 00:00:00 2001 From: nonon Date: Fri, 15 Dec 2023 19:59:38 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Chore:=20gitignore=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 475737c..f306256 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +# vscode +.vscode \ No newline at end of file From 5bc7bea45b2545e14a1d14ba9ebce3c97afc967c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=86=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=80=E1=85=A7=E1=86=BC?= Date: Fri, 15 Dec 2023 22:55:03 +0900 Subject: [PATCH 4/6] Chore : update build script --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ff4efb8..ed6264b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,6 +11,7 @@ jobs: build: runs-on: ubuntu-20.04 env: + REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} REACT_APP_NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} REACT_APP_NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }} REACT_APP_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }} @@ -43,6 +44,7 @@ jobs: echo "REACT_APP_REGION=$REACT_APP_REGION" >> .env.production env: + REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} REACT_APP_NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} REACT_APP_NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }} REACT_APP_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }} From d750fd1145c5169a5356ce24821c7f56586947cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=86=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=80=E1=85=A7=E1=86=BC?= Date: Fri, 15 Dec 2023 22:55:23 +0900 Subject: [PATCH 5/6] Feat : add login request --- src/api/hooks/useLogin.ts | 14 ++++++++++++++ src/component/home/KakaoOauth.tsx | 11 +++++++++++ src/component/home/NaverOauth.tsx | 11 +++++++++++ src/shared/axios.ts | 4 ++-- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/api/hooks/useLogin.ts diff --git a/src/api/hooks/useLogin.ts b/src/api/hooks/useLogin.ts new file mode 100644 index 0000000..16f7536 --- /dev/null +++ b/src/api/hooks/useLogin.ts @@ -0,0 +1,14 @@ +import { useQuery } from 'react-query'; +import instance from 'shared/axios'; + +export const useLogin = (codeValue: string) => { + return useQuery( + ['login'], + async () => await instance.post(`/api/user/kakao?code=${codeValue}`), + { + onSuccess(data) { + return data; + }, + } + ); +}; diff --git a/src/component/home/KakaoOauth.tsx b/src/component/home/KakaoOauth.tsx index 8dee543..8e5c22b 100644 --- a/src/component/home/KakaoOauth.tsx +++ b/src/component/home/KakaoOauth.tsx @@ -1,9 +1,20 @@ +import { useEffect } from 'react'; import { useLocation } from 'react-router'; +import instance from 'shared/axios'; export default function KakaoOauth() { const location = useLocation(); const urlParams = new URLSearchParams(location.search); const codeValue = urlParams.get('code'); + const Login = async () => { + const response = await instance.post(`/api/user/kakao?code=${codeValue}`); + return response; + }; + + useEffect(() => { + console.log(Login()); + }, []); + return <>카카오 리다이렉트 페이지; } diff --git a/src/component/home/NaverOauth.tsx b/src/component/home/NaverOauth.tsx index 01ce972..95eb5ec 100644 --- a/src/component/home/NaverOauth.tsx +++ b/src/component/home/NaverOauth.tsx @@ -1,9 +1,20 @@ +import { useEffect } from 'react'; import { useLocation } from 'react-router'; +import instance from 'shared/axios'; export default function NaverOauth() { const location = useLocation(); const urlParams = new URLSearchParams(location.search); const codeValue = urlParams.get('code'); + const Login = async () => { + const response = await instance.post(`/api/user/naver?code=${codeValue}`); + return response; + }; + + useEffect(() => { + console.log(Login()); + }, []); + return <>네이버 리다이렉트 페이지; } diff --git a/src/shared/axios.ts b/src/shared/axios.ts index 27d283d..2248676 100644 --- a/src/shared/axios.ts +++ b/src/shared/axios.ts @@ -44,10 +44,10 @@ instance.interceptors.response.use( return axios(originalRequest); } if (response.status === 404) { - return window.location.replace('/notfound'); + // return window.location.replace('/notfound'); } if (response.status === 504) { - return window.location.replace('/connectfail'); + // return window.location.replace('/connectfail'); } if (response.status === 400) { return response; From e5ac0842009d24ebb684e72e1bb904debb2df411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=86=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=80=E1=85=A7=E1=86=BC?= Date: Fri, 15 Dec 2023 22:59:27 +0900 Subject: [PATCH 6/6] Fix : remove login hook --- src/api/hooks/useLogin.ts | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/api/hooks/useLogin.ts diff --git a/src/api/hooks/useLogin.ts b/src/api/hooks/useLogin.ts deleted file mode 100644 index 16f7536..0000000 --- a/src/api/hooks/useLogin.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { useQuery } from 'react-query'; -import instance from 'shared/axios'; - -export const useLogin = (codeValue: string) => { - return useQuery( - ['login'], - async () => await instance.post(`/api/user/kakao?code=${codeValue}`), - { - onSuccess(data) { - return data; - }, - } - ); -};