Skip to content

Commit

Permalink
πŸš€ Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaem03 authored Nov 13, 2024
2 parents 9c1d189 + 8bf37d1 commit 3a1a56f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 51 deletions.
49 changes: 18 additions & 31 deletions src/apis/nuguIntro.js
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
22 changes: 7 additions & 15 deletions src/pages/nuguIntro/NuguIntro.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 4 additions & 1 deletion src/pages/nuguIntro/WriteIntro.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,6 +23,7 @@ export const WriteIntro = () => {
} = useIntroForm();

const navigate = useNavigate();
const { uuid } = useParams();

const handleSubmit = async () => {
try {
Expand All @@ -30,8 +32,9 @@ export const WriteIntro = () => {
keyword1,
keyword2,
keyword3,
uuid,
});
navigate("/intro");
navigate(-1);
return response;
} catch (err) {
throw err;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/onBoarding/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions src/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const router = createBrowserRouter([
element: <SignUpSubmit />,
},
{
path: "/intro",
path: "/nuguIntro/:uuid",
element: <NuguIntro />,
},
{
path: "/intro/write",
path: "/nuguIntro/write/:uuid",
element: <WriteIntro />,
},
{
Expand Down

0 comments on commit 3a1a56f

Please sign in to comment.