Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/StrokeBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const StrokeBanner = () => {

const handleNavigate = () => {
const mode = "virtualFriend";
navigate("/select-info", { state: mode });
navigate("/select-info", { state: { type: mode } });
};

return (
Expand Down
5 changes: 4 additions & 1 deletion src/components/button/KakaoLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const KakaoLoginButton = () => {
const kakaoRestApiKey = import.meta.env.VITE_KAKAO_REST_API_KEY;
const kakaoRedirectUrl = import.meta.env.VITE_KAKAO_REDIRECT_URI;
const kakaoRedirectUrl =
import.meta.env.MODE === "production"
? import.meta.env.VITE_KAKAO_PRODUCTION_REDIRECT_URI
: import.meta.env.VITE_KAKAO_DEVELOP_REDIRECT_URI;

const kakaoURL = `https://kauth.kakao.com/oauth/authorize?client_id=${kakaoRestApiKey}&redirect_uri=${kakaoRedirectUrl}&response_type=code`;

Expand Down
4 changes: 2 additions & 2 deletions src/pages/SelectInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation, useNavigate } from "react-router-dom";
import FormButton from "@/components/button/FormButton";
import Header from "@/components/header/Header";
import { getMBTIgroup, mapAgeToNumber } from "@/utils/helpers";
import instance from "@/api/axios";
import { authInstance } from "@/api/axios";
import ToastMessage from "@/components/ToastMessage";
import { trackEvent } from "@/libs/analytics";

Expand Down Expand Up @@ -192,7 +192,7 @@ const SelectInfo = () => {
type === "virtualFriend" ? "api/virtual-friend" : "api/fast-friend";

try {
const response = await instance.post<FriendResponse>(
const response = await authInstance.post<FriendResponse>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

`/${apiUrl}`,
selectedData
);
Expand Down
13 changes: 8 additions & 5 deletions src/store/useAuthStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ const useAuthStore = create(
accessToken: null,
login: async (code: string) => {
try {
const res = await instance.get(
`/api/kakao/login?code=${code}`
// + "&redirectUrl=https://localhost:5173/kakao-login"
);
const requestURI =
// 아래 코드는 백엔드팀에서 작업해주시면 동일한 uri로 바뀔 예정 -> 4.24 정준영
import.meta.env.MODE === "production"
? `/api/kakao/login?code=${code}`
: `/api/kakao/login?code=${code}&redirectUrl=https://localhost:5173/kakao-login`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


const res = await instance.get(requestURI);
set({
isLoggedIn: true,
accessToken: res.data as string
accessToken: res.data.data as string
});
return {
ok: true
Expand Down