diff --git a/user/package-lock.json b/user/package-lock.json index f586bdb..57bf2ce 100644 --- a/user/package-lock.json +++ b/user/package-lock.json @@ -1526,6 +1526,7 @@ "version": "1.7.9", "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", diff --git a/user/src/apis/club.js b/user/src/apis/club.js index 700aed3..1f0cb66 100644 --- a/user/src/apis/club.js +++ b/user/src/apis/club.js @@ -10,4 +10,4 @@ export const getClub = async () => { export const getClubDetail = async (clubname) => { const response = await instance.get(`${router}/info/${clubname}`); return response.data; -}; +}; \ No newline at end of file diff --git a/user/src/pages/SeeAllPage.jsx b/user/src/pages/SeeAllPage.jsx index 45b3bdd..511ecd2 100644 --- a/user/src/pages/SeeAllPage.jsx +++ b/user/src/pages/SeeAllPage.jsx @@ -1,11 +1,19 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import styled from "styled-components"; import { Header } from "../components/Header"; import { CollectBtn } from "../components/SeeallPage/CollectBtn"; import { Pagefooter } from "../components/PageFooter"; +import { getClub } from "../apis/club"; // API 호출 함수 가져오기 import searchBtn from "../assets/searchBtn.svg"; export const SeeAll = () => { + const [clubs, setClubs] = useState([]); // 동아리 데이터를 저장할 상태 + const [loading, setLoading] = useState(true); // 로딩 상태 관리 + + useEffect(() => { + getClub(); // 컴포넌트가 렌더링될 때 API 호출 + }, []); + return (
@@ -18,25 +26,33 @@ export const SeeAll = () => { - - {Array.from({ length: 8 }).map((_, index) => ( - - - - - -

대동여지도

-

대동여지도와 실록 서비스를 개발 및 운영 중인 동아리

-
-
- ))} -
+ {loading ? ( // 로딩 중일 때 표시 + 로딩 중... + ) : ( + + {clubs.map((club) => ( + + + + + +

{club.name}

+

{club.description}

+
+
+ ))} +
+ )} ); }; +const LoadingMessage = styled.div` + +`; + const Container = styled.div` margin: 0; padding: 0; diff --git a/user/src/pages/siwootest.jsx b/user/src/pages/siwootest.jsx new file mode 100644 index 0000000..85adf99 --- /dev/null +++ b/user/src/pages/siwootest.jsx @@ -0,0 +1,30 @@ +import { instance } from './instance'; + +export const apiSignUp = async ({ email, password, setModal, setInputs }) => { + try { + const response = await instance.post('/auth/signup', { + email, + password, + }); + + if (response.status === 200) { + console.log('회원가입 성공'); + + setInputs({ + email: '', + code: '', + password1: '', + password2: '', + }); + setModal(true); + } + } catch (error) { + if (error.response) { + if (error.response.status === 400) { + alert('비밀번호는 최대 64글자이고, 특수문자 한개가 포함되어야 합니다.'); + } else if (error.response.status === 409) { + alert('이미 가입된 유저입니다.'); + } + } + } +}; \ No newline at end of file diff --git a/user/utils/cookie.js b/user/src/utils/cookie.js similarity index 100% rename from user/utils/cookie.js rename to user/src/utils/cookie.js