From 4e9a3a494facd5fc95669e640f7bd88f58c9222a Mon Sep 17 00:00:00 2001 From: hyuna Date: Wed, 14 Aug 2024 23:42:34 +0900 Subject: [PATCH 1/8] =?UTF-8?q?add=20::=20=EC=83=81=ED=83=9C=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +- src/stroes/useChangeStatus.ts | 38 +++++ yarn.lock | 288 +++++++++++++++++++--------------- 3 files changed, 201 insertions(+), 130 deletions(-) create mode 100644 src/stroes/useChangeStatus.ts diff --git a/package.json b/package.json index 84b1413..dd0ace4 100644 --- a/package.json +++ b/package.json @@ -15,14 +15,15 @@ "react": "^18", "react-cookie": "^7.1.4", "react-cookies": "^0.1.1", - "react-dom": "^18" + "react-dom": "^18", + "zustand": "^4.5.4" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "postcss": "^8", - "tailwindcss": "^3.4.1", + "tailwindcss": "^3.4.9", "typescript": "^5" } } diff --git a/src/stroes/useChangeStatus.ts b/src/stroes/useChangeStatus.ts new file mode 100644 index 0000000..84df46b --- /dev/null +++ b/src/stroes/useChangeStatus.ts @@ -0,0 +1,38 @@ +import create from "zustand"; + +interface Student { + user_id: string; + status: string; +} + +interface AttendanceStore { + students: Student[]; + addStudent: (user_id: string, status?: string) => void; + updateStatus: (user_id: string, status: string) => void; + getStatus: (user_id: string) => string | undefined; +} + +const useAttendanceStore = create((set, get) => ({ + students: [], + + addStudent: (user_id, status = "ATTENDANCE") => { + set((state) => ({ + students: [...state.students, { user_id, status }], + })); + }, + + updateStatus: (user_id, status) => { + set((state) => ({ + students: state.students.map((student) => + student.user_id === user_id ? { ...student, status } : student + ), + })); + }, + + getStatus: (user_id) => { + return get().students.find((student) => student.user_id === user_id) + ?.status; + }, +})); + +export default useAttendanceStore; diff --git a/yarn.lock b/yarn.lock index d97bd70..544a9f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39,9 +39,9 @@ integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@^0.3.24": version "0.3.25" @@ -140,17 +140,17 @@ "@swc/counter" "^0.1.3" tslib "^2.4.0" -"@tanstack/query-core@5.29.0": - version "5.29.0" - resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.29.0.tgz#d0b3d12c07d5a47f42ab0c1ed4f317106f3d4b20" - integrity sha512-WgPTRs58hm9CMzEr5jpISe8HXa3qKQ8CxewdYZeVnA54JrPY9B1CZiwsCoLpLkf0dGRZq+LcX5OiJb0bEsOFww== +"@tanstack/query-core@5.51.21": + version "5.51.21" + resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.51.21.tgz#a510469c6c30d3de2a8b8798e340169a4b0fd08f" + integrity sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw== "@tanstack/react-query@^5.29.2": - version "5.29.2" - resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.29.2.tgz#c55ffbfaf9d8cf34212428db2b6c61ca6b545188" - integrity sha512-nyuWILR4u7H5moLGSiifLh8kIqQDLNOHGuSz0rcp+J75fNc8aQLyr5+I2JCHU3n+nJrTTW1ssgAD8HiKD7IFBQ== + version "5.51.23" + resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.51.23.tgz#83c223f4cb6054b206de8856b73ca7e41a63ba1f" + integrity sha512-CfJCfX45nnVIZjQBRYYtvVMIsGgWLKLYC4xcUiYEey671n1alvTZoCBaU9B85O8mF/tx9LPyrI04A6Bs2THv4A== dependencies: - "@tanstack/query-core" "5.29.0" + "@tanstack/query-core" "5.51.21" "@types/cookie@^0.6.0": version "0.6.0" @@ -166,9 +166,9 @@ hoist-non-react-statics "^3.3.0" "@types/node@^20": - version "20.12.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" - integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== + version "20.14.15" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.15.tgz#e59477ab7bc7db1f80c85540bfd192a0becc588b" + integrity sha512-Fz1xDMCF/B00/tYSVMlmK7hVeLh7jE5f3B7X1/hmV0MJBwE27KlS7EvD/Yp+z1lm8mVhwV5w+n8jOZG8AfTlKw== dependencies: undici-types "~5.26.4" @@ -178,16 +178,16 @@ integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== "@types/react-dom@^18": - version "18.2.25" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.25.tgz#2946a30081f53e7c8d585eb138277245caedc521" - integrity sha512-o/V48vf4MQh7juIKZU2QGDfli6p1+OOi5oXx36Hffpc9adsHeXjVp8rHuPkjd8VT8sOJ2Zp05HR7CdpGTIUFUA== + version "18.3.0" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.0.tgz#0cbc818755d87066ab6ca74fbedb2547d74a82b0" + integrity sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg== dependencies: "@types/react" "*" "@types/react@*", "@types/react@^18": - version "18.2.79" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.79.tgz#c40efb4f255711f554d47b449f796d1c7756d865" - integrity sha512-RwGAGXPl9kSXwdNTafkOEuFrTBD5SA2B3iEB96xi8+xu5ddUa/cpvyVCSNn+asgLCTHkb5ZxN8gbuibYJi4s1w== + version "18.3.3" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.3.tgz#9679020895318b0915d7a3ab004d92d33375c45f" + integrity sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw== dependencies: "@types/prop-types" "*" csstype "^3.0.2" @@ -238,9 +238,9 @@ asynckit@^0.4.0: integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== axios@^1.6.8: - version "1.6.8" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66" - integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ== + version "1.7.3" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.3.tgz#a1125f2faf702bc8e8f2104ec3a76fab40257d85" + integrity sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw== dependencies: follow-redirects "^1.15.6" form-data "^4.0.0" @@ -263,12 +263,12 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.3, braces@~3.0.3: +braces@^3.0.3, braces@~3.0.2: version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" busboy@1.6.0: version "1.6.0" @@ -283,9 +283,9 @@ camelcase-css@^2.0.1: integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== caniuse-lite@^1.0.30001579: - version "1.0.30001610" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001610.tgz#2f44ed6e21d359e914271ae35b68903632628ccf" - integrity sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA== + version "1.0.30001651" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" + integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== chokidar@^3.5.3: version "3.6.0" @@ -293,7 +293,7 @@ chokidar@^3.5.3: integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== dependencies: anymatch "~3.1.2" - braces "~3.0.3" + braces "~3.0.2" glob-parent "~5.1.2" is-binary-path "~2.1.0" is-glob "~4.0.1" @@ -408,10 +408,10 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" @@ -421,9 +421,9 @@ follow-redirects@^1.15.6: integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== foreground-child@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" - integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== + version "3.3.0" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77" + integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg== dependencies: cross-spawn "^7.0.0" signal-exit "^4.0.1" @@ -462,22 +462,23 @@ glob-parent@^6.0.2: is-glob "^4.0.3" glob@^10.3.10: - version "10.3.12" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.12.tgz#3a65c363c2e9998d220338e88a5f6ac97302960b" - integrity sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg== + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== dependencies: foreground-child "^3.1.0" - jackspeak "^2.3.6" - minimatch "^9.0.1" - minipass "^7.0.4" - path-scurry "^1.10.2" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" graceful-fs@^4.2.11: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -hasown@^2.0.0: +hasown@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== @@ -499,11 +500,11 @@ is-binary-path@~2.1.0: binary-extensions "^2.0.0" is-core-module@^2.13.0: - version "2.13.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" - integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== dependencies: - hasown "^2.0.0" + hasown "^2.0.2" is-extglob@^2.1.1: version "2.1.1" @@ -532,19 +533,19 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -jackspeak@^2.3.6: - version "2.3.6" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.3.6.tgz#647ecc472238aee4b06ac0e461acc21a8c505ca8" - integrity sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ== +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== dependencies: "@isaacs/cliui" "^8.0.2" optionalDependencies: "@pkgjs/parseargs" "^0.11.0" jiti@^1.21.0: - version "1.21.0" - resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d" - integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== + version "1.21.6" + resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" + integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== "js-tokens@^3.0.0 || ^4.0.0": version "4.0.0" @@ -557,9 +558,9 @@ lilconfig@^2.1.0: integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== lilconfig@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.1.tgz#9d8a246fa753106cfc205fd2d77042faca56e5e3" - integrity sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ== + version "3.1.2" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.2.tgz#e4a7c3cb549e3a606c8dcc32e5ae1005e62c05cb" + integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow== lines-and-columns@^1.1.6: version "1.2.4" @@ -574,9 +575,9 @@ loose-envify@^1.1.0: js-tokens "^3.0.0 || ^4.0.0" lru-cache@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" - integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== merge2@^1.3.0: version "1.4.1" @@ -584,9 +585,9 @@ merge2@^1.3.0: integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== micromatch@^4.0.4, micromatch@^4.0.5: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== dependencies: braces "^3.0.3" picomatch "^2.3.1" @@ -603,17 +604,17 @@ mime-types@^2.1.12: dependencies: mime-db "1.52.0" -minimatch@^9.0.1: - version "9.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" - integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== dependencies: brace-expansion "^2.0.1" -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.0.4: - version "7.0.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" - integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== mz@^2.7.0: version "2.7.0" @@ -667,6 +668,11 @@ object-hash@^3.0.0: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== +package-json-from-dist@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz#e501cd3094b278495eb4258d4c9f6d5ac3019f00" + integrity sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw== + path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -677,18 +683,18 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-scurry@^1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.2.tgz#8f6357eb1239d5fa1da8b9f70e9c080675458ba7" - integrity sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA== +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== dependencies: lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.0, picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" @@ -730,16 +736,16 @@ postcss-load-config@^4.0.1: yaml "^2.3.4" postcss-nested@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-6.0.1.tgz#f83dc9846ca16d2f4fa864f16e9d9f7d0961662c" - integrity sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ== + version "6.2.0" + resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-6.2.0.tgz#4c2d22ab5f20b9cb61e2c5c5915950784d068131" + integrity sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ== dependencies: - postcss-selector-parser "^6.0.11" + postcss-selector-parser "^6.1.1" -postcss-selector-parser@^6.0.11: - version "6.0.16" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz#3b88b9f5c5abd989ef4e2fc9ec8eedd34b20fb04" - integrity sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw== +postcss-selector-parser@^6.0.11, postcss-selector-parser@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz#5be94b277b8955904476a2400260002ce6c56e38" + integrity sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" @@ -759,12 +765,12 @@ postcss@8.4.31: source-map-js "^1.0.2" postcss@^8, postcss@^8.4.23: - version "8.4.38" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" - integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== + version "8.4.41" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.41.tgz#d6104d3ba272d882fe18fc07d15dc2da62fa2681" + integrity sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ== dependencies: nanoid "^3.3.7" - picocolors "^1.0.0" + picocolors "^1.0.1" source-map-js "^1.2.0" proxy-from-env@^1.1.0: @@ -778,9 +784,9 @@ queue-microtask@^1.2.2: integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== react-cookie@^7.1.4: - version "7.1.4" - resolved "https://registry.yarnpkg.com/react-cookie/-/react-cookie-7.1.4.tgz#1e35c9f11394b44fbbc30c5eba1287d89258e993" - integrity sha512-wDxxa/HYaSXSMlyWJvJ5uZTzIVtQTPf1gMksFgwAz/2/W3lCtY8r4OChCXMPE7wax0PAdMY97UkNJedGv7KnDw== + version "7.2.0" + resolved "https://registry.yarnpkg.com/react-cookie/-/react-cookie-7.2.0.tgz#5770cd8d6b3c60c5d34ec4b7926f90281aee22ae" + integrity sha512-mqhPERUyfOljq5yJ4woDFI33bjEtigsl8JDJdPPeNhr0eSVZmBc/2Vdf8mFxOUktQxhxTR1T+uF0/FRTZyBEgw== dependencies: "@types/hoist-non-react-statics" "^3.3.5" hoist-non-react-statics "^3.3.2" @@ -795,12 +801,12 @@ react-cookies@^0.1.1: object-assign "^4.1.1" react-dom@^18: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" - integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" + integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== dependencies: loose-envify "^1.1.0" - scheduler "^0.23.0" + scheduler "^0.23.2" react-is@^16.7.0: version "16.13.1" @@ -808,9 +814,9 @@ react-is@^16.7.0: integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== react@^18: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" - integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" + integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== dependencies: loose-envify "^1.1.0" @@ -849,10 +855,10 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== +scheduler@^0.23.2: + version "0.23.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" + integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== dependencies: loose-envify "^1.1.0" @@ -883,8 +889,16 @@ streamsearch@^1.1.0: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -902,8 +916,14 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: - name strip-ansi-cjs +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -942,10 +962,10 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -tailwindcss@^3.4.1: - version "3.4.3" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.3.tgz#be48f5283df77dfced705451319a5dffb8621519" - integrity sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A== +tailwindcss@^3.4.9: + version "3.4.9" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.9.tgz#9e04cddce1924d530df62af37d3520f0e2a9d85e" + integrity sha512-1SEOvRr6sSdV5IDf9iC+NU4dhwdqzF4zKKq3sAbasUWHEM6lsMhX+eNN5gkPx1BvLFEnZQEUFbXnGj8Qlp83Pg== dependencies: "@alloc/quick-lru" "^5.2.0" arg "^5.0.2" @@ -997,14 +1017,14 @@ ts-interface-checker@^0.1.9: integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== tslib@^2.4.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== typescript@^5: - version "5.4.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" - integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== undici-types@~5.26.4: version "5.26.5" @@ -1012,13 +1032,18 @@ undici-types@~5.26.4: integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== universal-cookie@^7.0.0: - version "7.1.4" - resolved "https://registry.yarnpkg.com/universal-cookie/-/universal-cookie-7.1.4.tgz#d11bb95e405639c0ff0b467a64a5ccc5ce97dfc6" - integrity sha512-Q+DVJsdykStWRMtXr2Pdj3EF98qZHUH/fXv/gwFz/unyToy1Ek1w5GsWt53Pf38tT8Gbcy5QNsj61Xe9TggP4g== + version "7.2.0" + resolved "https://registry.yarnpkg.com/universal-cookie/-/universal-cookie-7.2.0.tgz#1f3fa9c575d863ac41b4e42272d240ae2d32c047" + integrity sha512-PvcyflJAYACJKr28HABxkGemML5vafHmiL4ICe3e+BEKXRMt0GaFLZhAwgv637kFFnnfiSJ8e6jknrKkMrU+PQ== dependencies: "@types/cookie" "^0.6.0" cookie "^0.6.0" +use-sync-external-store@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + util-deprecate@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -1050,6 +1075,13 @@ wrap-ansi@^8.1.0: strip-ansi "^7.0.1" yaml@^2.3.4: - version "2.4.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.1.tgz#2e57e0b5e995292c25c75d2658f0664765210eed" - integrity sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg== + version "2.5.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.0.tgz#c6165a721cf8000e91c36490a41d7be25176cf5d" + integrity sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw== + +zustand@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.5.4.tgz#63abdd81edfb190bc61e0bbae045cc4d52158a05" + integrity sha512-/BPMyLKJPtFEvVL0E9E9BTUM63MNyhPGlvxk1XjrfWTUlV+BR8jufjsovHzrtR6YNcBEcL7cMHovL1n9xHawEg== + dependencies: + use-sync-external-store "1.2.0" From a03ca62417a7d474be3e7af1002ccb197ccae5ff Mon Sep 17 00:00:00 2001 From: hyuna Date: Wed, 14 Aug 2024 23:42:54 +0900 Subject: [PATCH 2/8] =?UTF-8?q?chore=20::=20api=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/afterManage/index.ts | 30 +++++++++++------------------- src/api/type.ts | 14 +++----------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/api/afterManage/index.ts b/src/api/afterManage/index.ts index 523a2d1..3393b3e 100644 --- a/src/api/afterManage/index.ts +++ b/src/api/afterManage/index.ts @@ -9,14 +9,16 @@ import { } from "../type"; import apiError from "@/hook/errorHandling"; -export const GetClubList = (club: string) => { +export const GetClubList = (club: string, period: number) => { const { handleError } = apiError(); return useQuery({ - queryKey: ["GetClubList", club], + queryKey: ["GetClubList", club, period], queryFn: async () => { try { - const response = await instance.get(`/attendance/club?club=${club}`); - return response.data; + const { data } = await instance.get( + `/attendance/club?club=${club}&period=${period}` + ); + return data; } catch (error) { handleError(error); } @@ -26,10 +28,13 @@ export const GetClubList = (club: string) => { export const FixStatus = () => { const { handleError } = apiError(); - return useMutation({ + return useMutation({ mutationFn: async (param) => { try { - await instance.patch(`/attendance/modify`, param); + await instance.patch( + `/attendance/modify?period=${param.period}`, + param.data + ); } catch (error) { handleError(error); } @@ -97,16 +102,3 @@ export const AfterStudentDelete = () => { }, }); }; - -export const CheckStatus = () => { - const { handleError } = apiError(); - return useMutation({ - mutationFn: async (param) => { - try { - await instance.patch(`/attendance/modify`, param); - } catch (error) { - handleError(error); - } - }, - }); -}; diff --git a/src/api/type.ts b/src/api/type.ts index 097a605..b381109 100644 --- a/src/api/type.ts +++ b/src/api/type.ts @@ -37,12 +37,8 @@ export interface ClubList { grade: number; class_num: number; num: number; + status: string; classroom_name: string; - status6: string; - status7: string; - status8: string; - status9: string; - status10: string; } export interface AttendanceChack { @@ -52,7 +48,7 @@ export interface AttendanceChack { export interface ChangeStatus { user_id: string; - status_list: string[]; + status: string; } export interface FloorClass { @@ -86,11 +82,7 @@ export interface AfterStudent { num: number; name: string; classroom_name: string; - status1: string; - status2: string; - status3: string; - status4: string; - status5: string; + status: string; } export interface ChangeClub { From d6d08a207297009fdb68e963cf9837a1f686dd28 Mon Sep 17 00:00:00 2001 From: hyuna Date: Wed, 14 Aug 2024 23:43:10 +0900 Subject: [PATCH 3/8] =?UTF-8?q?chore=20::=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/index.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/modal/index.tsx b/src/components/modal/index.tsx index 146903e..f80e572 100644 --- a/src/components/modal/index.tsx +++ b/src/components/modal/index.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import Button from "../button"; import AutoInput from "../input/auto"; @@ -29,15 +29,12 @@ const Modal: React.FC = ({ onConfirm, name, }) => { - const [inputValue, setInputValue] = useState(""); - const [addstudent, setAddstudent] = useState({ student: "", }); const AutohandleChange = ({ text, name }: ChangeProps) => { setAddstudent({ ...addstudent, [name]: text }); - setInputValue(text); }; const renderButtons = () => { From 4bfcfee0ae79519e1b3828e7796468805c8ca3fc Mon Sep 17 00:00:00 2001 From: hyuna Date: Wed, 14 Aug 2024 23:43:44 +0900 Subject: [PATCH 4/8] =?UTF-8?q?fix=20::=20=EB=B0=A9=EA=B3=BC=ED=9B=84=20?= =?UTF-8?q?=EC=B6=9C=EA=B2=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/afterManage/page.tsx | 107 ++++------------------ src/components/list/afterManage/index.tsx | 76 ++------------- 2 files changed, 28 insertions(+), 155 deletions(-) diff --git a/src/app/afterManage/page.tsx b/src/app/afterManage/page.tsx index f675f63..a5418c2 100644 --- a/src/app/afterManage/page.tsx +++ b/src/app/afterManage/page.tsx @@ -1,6 +1,5 @@ "use client"; import { - CheckStatus, FixStatus, GetAfterStudent, GetClubList, @@ -14,87 +13,36 @@ import AfterList from "@/components/list/afterManage"; import AfterDelete from "@/components/list/delete"; import Modal from "@/components/modal"; import useAcceptListSelection from "@/hook/handleAcceptListClick"; +import useAttendanceStore from "@/stroes/useChangeStatus"; import { getStudentString, setStudentNum } from "@/util/util"; -import { useEffect, useState } from "react"; +import { useActionState, useEffect, useState } from "react"; const AfterManage = () => { const [edit, setEdit] = useState(false); const [modal, setMadal] = useState(false); - const [clubList, setClubList] = useState([]); const [selectedTab, setSelectedTab] = useState(true); const [selectClassTime, setSelectClassTime] = useState(8); const [selectClub, setSelectClub] = useState("대동여지도"); const [studentData, setStudentData] = useState(); - const { data: getClub } = GetClubList(selectClub); + const { data: getClub } = GetClubList(selectClub, selectClassTime); + const [data, setData] = useState([]); const { mutate: Post } = PostStudent(); const { mutate: changeStatus } = FixStatus(); - const { data: getStudent } = GetAfterStudent(); - const { mutate: CulbCheck } = CheckStatus(); + const { data: getStudent, refetch: ReGetStudent } = GetAfterStudent(); const { handleAcceptListClick } = useAcceptListSelection(); - const handleSaveClub = async () => { - const updatedData: ChangeClub[] = []; - studentData?.forEach((item) => { - const localData = localStorage.getItem(item.id); - if (localData) { - const parsedData = JSON.parse(localData); - const studentData = { - user_id: item.id, - status_list: [ - parsedData[0], - parsedData[1], - parsedData[2], - parsedData[3], - parsedData[4], - ], - }; - updatedData.push(studentData); - } - }); + const { getStatus, students } = useAttendanceStore(); - try { - await changeStatus(updatedData, { + const handleSaveClub = async () => { + changeStatus( + { period: selectClassTime, data: students }, + { onSuccess: () => { alert("상태가 변경되었습니다"); + ReGetStudent(); }, - onError: (error) => { - alert(error.name); - }, - }); - } catch (error) { - updatedData.forEach((item) => { - localStorage.setItem(item.user_id, JSON.stringify(item.status_list)); - }); - console.log(error); - } - }; - - useEffect(() => { - if (getStudent) { - setStudentData(getStudent); - } - }, [getStudent]); - - const handleSaveModalConfirm = () => { - setEdit(false); - const updatedData: ChangeStatus[] = []; - clubList?.forEach((item) => { - const localData = localStorage.getItem(item.id); - if (localData) { - const parsedData = JSON.parse(localData); - const studentData = { - user_id: item.id, - status_list: [ - parsedData[0], - parsedData[1], - parsedData[2], - parsedData[3] || "ATTENDANCE", - parsedData[4] || "ATTENDANCE", - ], - }; - updatedData.push(studentData); } - }); - CulbCheck(updatedData); + ); + setEdit(false); }; const onClickSave = () => { @@ -115,13 +63,6 @@ const AfterManage = () => { setMadal(false); }; - useEffect(() => { - setClubList([]); - if (getClub) { - setClubList(getClub); - } - }, [getClub]); - useEffect(() => { const keys = Object.keys(localStorage); keys.forEach((key) => { @@ -186,17 +127,12 @@ const AfterManage = () => { >
{selectedTab ? ( - clubList.map((item, index) => ( + getClub?.map((item, index) => ( )) @@ -206,22 +142,17 @@ const AfterManage = () => {
{edit ? ( <> - {studentData?.map((item, index) => { + {getStudent?.map((item, index) => { return ( handleAcceptListClick(item.id, item.name) } - time={selectClassTime} class_name={item.classroom_name} /> ); @@ -233,7 +164,7 @@ const AfterManage = () => {
) : ( <> - {studentData?.map((item, index) => ( + {getStudent?.map((item, index) => ( ))} @@ -257,7 +188,7 @@ const AfterManage = () => { diff --git a/src/components/list/afterManage/index.tsx b/src/components/list/afterManage/index.tsx index 4e376fe..0d603cb 100644 --- a/src/components/list/afterManage/index.tsx +++ b/src/components/list/afterManage/index.tsx @@ -1,28 +1,19 @@ "use client"; import StatusDrop from "@/components/dropdown/status"; +import useAttendanceStore from "@/stroes/useChangeStatus"; import React, { useEffect, useState } from "react"; interface NonReturnProp { - state1: string; - state2: string; - state3: string; - state4: string; - state5: string; + state: string; id: string; onClick?: () => void; after?: boolean; name: string; - time?: number; class_name?: string; } export const AfterList = ({ - state1, - state2, - state3, - state4, - state5, - time, + state, id, onClick, name, @@ -36,6 +27,8 @@ export const AfterList = ({ return "이동"; case "GO_OUT": return "외출"; + case "GO_HOME": + return "귀가"; case "DISALLOWED": return "무단"; case "PICNIC": @@ -47,61 +40,10 @@ export const AfterList = ({ } }; - const [statusList, setStatusList] = useState([]); + const { addStudent, getStatus } = useAttendanceStore(); - useEffect(() => { - setStatusList([state1, state2, state3, state4, state5]); - }, [state1, state2, state3, state4, state5]); - - useEffect(() => { - localStorage.setItem(id, JSON.stringify(statusList)); - }, [id, statusList]); - - const handleChange = (index: number, newState: string) => { - const newStatusList = [...statusList]; - for (let i = index; i < newStatusList.length; i++) { - newStatusList[i] = newState; - } - setStatusList(newStatusList); - }; - - const ClassCheck = (newState: string) => { - switch (time) { - case 6: - handleChange(0, newState); - break; - case 7: - handleChange(1, newState); - break; - case 8: - handleChange(2, newState); - break; - case 9: - handleChange(3, newState); - break; - case 10: - handleChange(4, newState); - break; - default: - break; - } - }; - - const changeProp = () => { - switch (time) { - case 6: - return state1; - case 7: - return state2; - case 8: - return state3; - case 9: - return state4 || ""; - case 10: - return state5 || ""; - default: - return ""; - } + const handleChange = (newState: string) => { + addStudent(id, newState); }; return ( @@ -120,7 +62,7 @@ export const AfterList = ({
)} - + From 546293e21d20f73ba58e9b70ada20af5b0cb9282 Mon Sep 17 00:00:00 2001 From: hyuna Date: Thu, 15 Aug 2024 00:11:14 +0900 Subject: [PATCH 5/8] =?UTF-8?q?chore=20::=20api=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/afterManage/index.ts | 2 +- src/api/attendanceCheck/index.ts | 32 ++++++++++++-------------------- src/api/type.ts | 2 +- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/api/afterManage/index.ts b/src/api/afterManage/index.ts index 3393b3e..fbe2540 100644 --- a/src/api/afterManage/index.ts +++ b/src/api/afterManage/index.ts @@ -28,7 +28,7 @@ export const GetClubList = (club: string, period: number) => { export const FixStatus = () => { const { handleError } = apiError(); - return useMutation({ + return useMutation({ mutationFn: async (param) => { try { await instance.patch( diff --git a/src/api/attendanceCheck/index.ts b/src/api/attendanceCheck/index.ts index c6f42c7..a4e4a34 100644 --- a/src/api/attendanceCheck/index.ts +++ b/src/api/attendanceCheck/index.ts @@ -1,30 +1,22 @@ import { useMutation, useQuery } from "@tanstack/react-query"; import { instance } from ".."; -import { AttendanceChack, ClubList } from "../type"; +import { ClubList } from "../type"; import apiError from "@/hook/errorHandling"; -export const GetStudentsAttendance = () => { +export const GetStudentsAttendance = ( + grade: number, + class_num: number, + period: number +) => { const { handleError } = apiError(); - return useMutation({ - mutationFn: async (param) => { + return useQuery({ + queryKey: [GetStudentsAttendance, grade, class_num, period], + queryFn: async () => { try { - const response = await instance.get( - `/attendance/grade?grade=${param.grade}&class_num=${param.class}` + const { data } = await instance.get( + `/attendance/grade?grade=${grade}&class_num=${class_num}&period=${period}` ); - return response.data; - } catch (error) { - handleError(error); - } - }, - }); -}; - -export const AttendanceSave = () => { - const { handleError } = apiError(); - return useMutation({ - mutationFn: async (param) => { - try { - await instance.patch("/attendance/modify", param); + return data; } catch (error) { handleError(error); } diff --git a/src/api/type.ts b/src/api/type.ts index b381109..56af8a7 100644 --- a/src/api/type.ts +++ b/src/api/type.ts @@ -43,7 +43,7 @@ export interface ClubList { export interface AttendanceChack { user_id: string; - status_list: string[]; + status: string; } export interface ChangeStatus { From 13d798c4cc44db85b5e78e3c52d0f511dba31a90 Mon Sep 17 00:00:00 2001 From: hyuna Date: Thu, 15 Aug 2024 00:11:35 +0900 Subject: [PATCH 6/8] =?UTF-8?q?chore=20::=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/afterManage/page.tsx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/app/afterManage/page.tsx b/src/app/afterManage/page.tsx index a5418c2..51e9d22 100644 --- a/src/app/afterManage/page.tsx +++ b/src/app/afterManage/page.tsx @@ -5,7 +5,6 @@ import { GetClubList, PostStudent, } from "@/api/afterManage"; -import { AfterStudent, ChangeClub, ChangeStatus, ClubList } from "@/api/type"; import BackGround from "@/components/background"; import Button from "@/components/button"; import Dropdown from "@/components/dropdown"; @@ -15,7 +14,7 @@ import Modal from "@/components/modal"; import useAcceptListSelection from "@/hook/handleAcceptListClick"; import useAttendanceStore from "@/stroes/useChangeStatus"; import { getStudentString, setStudentNum } from "@/util/util"; -import { useActionState, useEffect, useState } from "react"; +import { useState } from "react"; const AfterManage = () => { const [edit, setEdit] = useState(false); @@ -23,14 +22,12 @@ const AfterManage = () => { const [selectedTab, setSelectedTab] = useState(true); const [selectClassTime, setSelectClassTime] = useState(8); const [selectClub, setSelectClub] = useState("대동여지도"); - const [studentData, setStudentData] = useState(); const { data: getClub } = GetClubList(selectClub, selectClassTime); - const [data, setData] = useState([]); const { mutate: Post } = PostStudent(); const { mutate: changeStatus } = FixStatus(); const { data: getStudent, refetch: ReGetStudent } = GetAfterStudent(); const { handleAcceptListClick } = useAcceptListSelection(); - const { getStatus, students } = useAttendanceStore(); + const { students } = useAttendanceStore(); const handleSaveClub = async () => { changeStatus( @@ -63,15 +60,6 @@ const AfterManage = () => { setMadal(false); }; - useEffect(() => { - const keys = Object.keys(localStorage); - keys.forEach((key) => { - if (key.includes("-")) { - localStorage.removeItem(key); - } - }); - }, [selectClub]); - const handleClubChange = (selectedOption: string) => { setSelectClub(selectedOption); }; From 8625aacf3b9178dc2de7cf03f932d811bd8a2e10 Mon Sep 17 00:00:00 2001 From: hyuna Date: Thu, 15 Aug 2024 00:11:49 +0900 Subject: [PATCH 7/8] =?UTF-8?q?fix=20::=20=EC=9E=90=EC=8A=B5=EC=B6=9C?= =?UTF-8?q?=EA=B2=B0=EA=B4=80=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/attendanceCheck/page.tsx | 100 +++++++------------------------ 1 file changed, 20 insertions(+), 80 deletions(-) diff --git a/src/app/attendanceCheck/page.tsx b/src/app/attendanceCheck/page.tsx index 5403b06..cb0237f 100644 --- a/src/app/attendanceCheck/page.tsx +++ b/src/app/attendanceCheck/page.tsx @@ -1,32 +1,31 @@ "use client"; -import { AttendanceSave, GetStudentsAttendance } from "@/api/attendanceCheck"; -import { AttendanceChack, ClubList } from "@/api/type"; +import { GetStudentsAttendance } from "@/api/attendanceCheck"; +import { FixStatus } from "@/api/afterManage"; import BackGround from "@/components/background"; import Button from "@/components/button"; import Dropdown from "@/components/dropdown"; import AfterList from "@/components/list/afterManage"; import { getStudentString } from "@/util/util"; -import { useEffect, useState } from "react"; +import { useState } from "react"; +import useAttendanceStore from "@/stroes/useChangeStatus"; const attendanceCheck = () => { - const [students, setStudents] = useState([]); const [selectClassTime, setSelectClassTime] = useState(8); const [selectedGrade, setSelectedGrade] = useState(1); const [selectedClass, setSelectedClass] = useState(1); - const { mutate: getStudentsAttendance } = GetStudentsAttendance(); - const { mutate: attendanceSave } = AttendanceSave(); + const { data: GetStudent, refetch: ReGetStudent } = GetStudentsAttendance( + selectedGrade, + selectedClass, + selectClassTime + ); + const { mutate: attendanceSave } = FixStatus(); + const { students } = useAttendanceStore(); const handleGradeChange = (selectedOption: number) => { - if (selectedGrade !== selectedOption) { - setStudents([]); - } setSelectedGrade(selectedOption); }; const handleClassChange = (selectedOption: number) => { - if (selectedClass !== selectedOption) { - setStudents([]); - } setSelectedClass(selectedOption); }; @@ -34,71 +33,17 @@ const attendanceCheck = () => { setSelectClassTime(selectedOption); }; - const Check = async () => { - try { - await getStudentsAttendance( - { - grade: selectedGrade, - class: selectedClass, - }, - { - onSuccess: (data) => { - setStudents(data); - }, - } - ); - } catch (error) { - console.log(error); - } - }; - const AttandenceSaveFn = async () => { - const updatedData: AttendanceChack[] = []; - students?.forEach((item) => { - const localData = localStorage.getItem(item.id); - if (localData) { - const parsedData = JSON.parse(localData); - const studentData = { - user_id: item.id, - status_list: [ - parsedData[0], - parsedData[1], - parsedData[2], - parsedData[3], - parsedData[4], - ], - }; - updatedData.push(studentData); - } - }); - - try { - await attendanceSave(updatedData, { + attendanceSave( + { period: selectClassTime, data: students }, + { onSuccess: () => { - alert("저장되었습니다"); - location.reload(); - }, - onError: (error) => { - alert(error.name); + alert("변경되었습니다"); + ReGetStudent(); }, - }); - updatedData.forEach((item) => { - localStorage.setItem(item.user_id, JSON.stringify(item.status_list)); - }); - } catch (error) { - console.log(error); - } - }; - - useEffect(() => { - const keys = Object.keys(localStorage); - keys.forEach((key) => { - if (key.includes("-")) { - localStorage.removeItem(key); } - }); - Check(); - }, [selectedGrade, selectedClass]); + ); + }; return ( { TabOnclick={() => {}} >
- {students?.map((item, index) => ( + {GetStudent?.map((item, index) => ( From 769730d8c944921f7121f8194c5a7ccf96d3b92b Mon Sep 17 00:00:00 2001 From: hyuna Date: Mon, 19 Aug 2024 08:08:26 +0900 Subject: [PATCH 8/8] =?UTF-8?q?chore=20::=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/afterManage/page.tsx | 2 +- src/app/attendanceCheck/page.tsx | 2 +- src/components/list/afterManage/index.tsx | 2 +- src/{stroes => stores}/useChangeStatus.ts | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/{stroes => stores}/useChangeStatus.ts (100%) diff --git a/src/app/afterManage/page.tsx b/src/app/afterManage/page.tsx index 51e9d22..13e42b8 100644 --- a/src/app/afterManage/page.tsx +++ b/src/app/afterManage/page.tsx @@ -12,7 +12,7 @@ import AfterList from "@/components/list/afterManage"; import AfterDelete from "@/components/list/delete"; import Modal from "@/components/modal"; import useAcceptListSelection from "@/hook/handleAcceptListClick"; -import useAttendanceStore from "@/stroes/useChangeStatus"; +import useAttendanceStore from "@/stores/useChangeStatus"; import { getStudentString, setStudentNum } from "@/util/util"; import { useState } from "react"; diff --git a/src/app/attendanceCheck/page.tsx b/src/app/attendanceCheck/page.tsx index cb0237f..4df5bc1 100644 --- a/src/app/attendanceCheck/page.tsx +++ b/src/app/attendanceCheck/page.tsx @@ -7,7 +7,7 @@ import Dropdown from "@/components/dropdown"; import AfterList from "@/components/list/afterManage"; import { getStudentString } from "@/util/util"; import { useState } from "react"; -import useAttendanceStore from "@/stroes/useChangeStatus"; +import useAttendanceStore from "@/stores/useChangeStatus"; const attendanceCheck = () => { const [selectClassTime, setSelectClassTime] = useState(8); diff --git a/src/components/list/afterManage/index.tsx b/src/components/list/afterManage/index.tsx index 0d603cb..7a05e29 100644 --- a/src/components/list/afterManage/index.tsx +++ b/src/components/list/afterManage/index.tsx @@ -1,6 +1,6 @@ "use client"; import StatusDrop from "@/components/dropdown/status"; -import useAttendanceStore from "@/stroes/useChangeStatus"; +import useAttendanceStore from "@/stores/useChangeStatus"; import React, { useEffect, useState } from "react"; interface NonReturnProp { diff --git a/src/stroes/useChangeStatus.ts b/src/stores/useChangeStatus.ts similarity index 100% rename from src/stroes/useChangeStatus.ts rename to src/stores/useChangeStatus.ts