diff --git a/src/apis/nuguIntro.js b/src/apis/nuguIntro.js
index 07fbf21..4a39911 100644
--- a/src/apis/nuguIntro.js
+++ b/src/apis/nuguIntro.js
@@ -1,42 +1,29 @@
import { instance } from "./instance";
-import Cookies from "js-cookie";
-export const getIntroList = async () => {
+export const getIntroList = async (uuid) => {
try {
- const token = Cookies.get("access_token");
- if (token) {
- const response = await instance.get("/intro");
- console.log("getIntroList", response);
- } else {
- // const response = await instance.get(`/intro/${uuid}`);
- // console.log("getGuestIntroList", response);
- //TODO
- }
+ const response = await instance.get(`/intro/${uuid}`);
+ console.log("getGuestIntroList", response);
+ return response;
} catch (error) {
throw error;
}
};
-export const postIntro = async ({ content, keyword1, keyword2, keyword3 }) => {
+export const postIntro = async ({
+ content,
+ keyword1,
+ keyword2,
+ keyword3,
+ uuid,
+}) => {
try {
- const token = Cookies.get("access_token");
- if (token) {
- const response = await instance.post("/intro", {
- content,
- keyword1,
- keyword2,
- keyword3,
- });
- return response;
- } else {
- // const response = await instance.post(`/intro/${uuid}`, {
- // content,
- // keyword1,
- // keyword2,
- // keyword3,
- // });
- // return response;
- //TODO
- }
+ const response = await instance.post(`/intro/${uuid}`, {
+ content,
+ keyword1,
+ keyword2,
+ keyword3,
+ });
+ return response;
} catch (error) {
throw error;
}
diff --git a/src/pages/nuguIntro/NuguIntro.jsx b/src/pages/nuguIntro/NuguIntro.jsx
index 83a3b31..984dcc6 100644
--- a/src/pages/nuguIntro/NuguIntro.jsx
+++ b/src/pages/nuguIntro/NuguIntro.jsx
@@ -9,35 +9,27 @@ import { NavigateBar } from "@components/common/navigateBar/NavigateBar";
import { RankingBox } from "@components/rankingBox/RankingBox";
import { IntroField } from "@components/common/introField/IntroField";
import { Layout } from "@components/common/layout/Layout";
-
+import { useParams } from "react-router-dom";
import { getIntroList } from "@apis/nuguIntro";
export const NuguIntro = () => {
+ const { uuid } = useParams();
const navigate = useNavigate();
const [introList, setIntroList] = useState([]);
- // const rank = [
- // {
- // keyword1: "순수한",
- // keyword2: "관대한",
- // keyword3: "다정한",
- // intro_list: ["착한 친구입니다.", "재밌는 친구입니다~"],
- // },
- // ];
- // //누구 소개-사용자get
-
useEffect(() => {
+ if (!uuid) return;
const fetchData = async () => {
try {
- const Data = await getIntroList();
- setIntroList(Data);
+ const Data = await getIntroList(uuid);
+ setIntroList(Data.data);
} catch (error) {
throw error;
}
};
fetchData();
- }, []);
+ }, [uuid]);
- const isNuguIntro = introList && introList.length > 0 ? introList[0] : null;
+ const isNuguIntro = introList && introList.length > 0 ? introList : null;
const moveOnintro = () => {
navigate("/intro/write");
diff --git a/src/pages/nuguIntro/WriteIntro.jsx b/src/pages/nuguIntro/WriteIntro.jsx
index faf8797..4688b64 100644
--- a/src/pages/nuguIntro/WriteIntro.jsx
+++ b/src/pages/nuguIntro/WriteIntro.jsx
@@ -9,6 +9,7 @@ import { CHIP_DATA } from "@constants/chip";
import { useNavigate } from "react-router-dom";
import { useIntroForm } from "./_hooks/useIntroForm";
import { postIntro } from "@apis/nuguIntro";
+import { useParams } from "react-router-dom";
export const WriteIntro = () => {
const {
content,
@@ -22,6 +23,7 @@ export const WriteIntro = () => {
} = useIntroForm();
const navigate = useNavigate();
+ const { uuid } = useParams();
const handleSubmit = async () => {
try {
@@ -30,8 +32,9 @@ export const WriteIntro = () => {
keyword1,
keyword2,
keyword3,
+ uuid,
});
- navigate("/intro");
+ navigate(-1);
return response;
} catch (err) {
throw err;
diff --git a/src/pages/onBoarding/styled.js b/src/pages/onBoarding/styled.js
index 0de85b5..0cef339 100644
--- a/src/pages/onBoarding/styled.js
+++ b/src/pages/onBoarding/styled.js
@@ -7,8 +7,8 @@ export const Wrapper = styled.div`
width: 100%;
height: calc(var(--vh, 1vh) * 100);
gap: 3rem;
- padding-bottom: 1rem;
- padding-top: 1rem;
+ padding-bottom: 2rem;
+ padding-top: 2rem;
`;
export const LogoContainer = styled.div`
diff --git a/src/router.jsx b/src/router.jsx
index dec7041..9c48938 100644
--- a/src/router.jsx
+++ b/src/router.jsx
@@ -35,11 +35,11 @@ const router = createBrowserRouter([
element: ,
},
{
- path: "/intro",
+ path: "/nuguIntro/:uuid",
element: ,
},
{
- path: "/intro/write",
+ path: "/nuguIntro/write/:uuid",
element: ,
},
{