Skip to content

Commit

Permalink
Fix: 투표 종료 버튼, 로그인 Redirect url 수정 (#81)
Browse files Browse the repository at this point in the history
* Fix: scrollbar 숨기기, url 복사 baseURL 수정

* Fix: user 페이지 박스 스타일 수정

* Fix: 오류 제거, Feat: 라우팅 에러 처리

* Fix: vercel warning 제거

* Chore: 모임 생성 useEffect 변수 삭제

* Fix: 투표 종료 버튼 보이기, Kakao btn url 변경
  • Loading branch information
goeun208 authored Feb 19, 2024
1 parent 9b21339 commit 7a595ef
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/common/button/kakao/KakaoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRouter } from 'next/router';
const KakaoLoginButton = () => {
const router = useRouter();
const REST_API_KEY = 'da98b670c28171c6bae91e1f6fa272c3';
const REDIRECT_URI = 'http://localhost:3000/login/kakao';
const REDIRECT_URI = 'https://www.moidot.co.kr/login/kakao';
const LINK = `https://kauth.kakao.com/oauth/authorize?client_id=${REST_API_KEY}&redirect_uri=${REDIRECT_URI}&response_type=code`;

function kakaoLogin() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/button/url/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const UrlButton = ({ pathname }: UrlProps) => {
{
title: '모이닷으로 가기',
link: {
mobileWebUrl: 'https://developers.kakao.com',
webUrl: `http://localhost:3000/invite/${pathname.split('/').slice(-1)[0]}`,
mobileWebUrl: `https://www.moidot.co.kr/invite/${pathname.split('/').slice(-1)[0]}`,
webUrl: `https://www.moidot.co.kr/invite/${pathname.split('/').slice(-1)[0]}`,
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const Footer = () => {
<div className="flex flex-row items-center gap-[32px]">
<div className="font-normal font-Pretendard text-white text-b2">이용약관</div>
<div className="font-normal font-Pretendard text-white text-b2">|</div>
<div className="font-normal font-Pretendard text-white text-b2">개인정보처리방침</div>
<div className="font-normal font-Pretendard text-white text-b2">개인정보 수집 및 처리방침</div>
<div className="font-normal font-Pretendard text-white text-b2">|</div>
<div className="font-normal font-Pretendard text-white text-b2">위치기반서비스이용약관</div>
<div className="font-normal font-Pretendard text-white text-b2">위치정보 수집 및 활용방침</div>
<div className="font-normal font-Pretendard text-white text-b2">|</div>
<div className="font-normal font-Pretendard text-white text-b2">소개</div>
<div className="font-normal font-Pretendard text-white text-b2">|</div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import api from '@/services/TokenService';
import { useGetGroup } from '@/hooks/useGetGroup';
import KakaoMap from './KakaoMap';
import { groupIdAtom } from '@/states/groupIdAtom';

interface MainProps {
id: string;
}
Expand All @@ -34,12 +35,17 @@ const Main = ({ id }: MainProps) => {
// 0번째 추천 지역 대상으로 lat,lng 추출

console.log(groupData);

if (groupData) {
lat = groupData?.data[0].latitude;
lng = groupData?.data[0].longitude;
local = groupData?.data[0].name;
}

if (groupNameData) {
sessionStorage.setItem('adminId', groupNameData?.data?.adminEmail);
}

// 현재 로그인된 유저의 path
const userPath = groupData?.data[0].moveUserInfo.filter((item) => item.userId === userId);
// 유저 이외의 사람들의 path
Expand Down
16 changes: 12 additions & 4 deletions src/pages/vote/detail/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useGetGroupVote } from '@/hooks/useGetGroupVote';
import { VoteStatusData } from '@/types/VoteType';
import api from '@/services/TokenService';
import { useRecoilValue, RecoilEnv } from 'recoil';
import { groupAdminIdAtom } from '@/states/groupAdminIdAtom';
import { VoteSelectData, postGroupVoteSelect } from '@/apis/postGroupVoteSelect';
import { useMutation } from '@tanstack/react-query';
import { groupIdAtom } from '@/states/groupIdAtom';
Expand All @@ -23,6 +22,7 @@ const VoteDetailPage = () => {
RecoilEnv.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED = false;
// eslint-disable-next-line react-hooks/exhaustive-deps
let votePlaceIds: any = [];
// const [voteIds, setVoteIds] = useState<any>();
const locationUrl = useRouter();
const [voteData, setVoteData] = useState<VoteData>(); // 투표 전체 데이터
const [voteEndAt, setVoteEndAt] = useState<any>(''); // 투표 종료 시간 데이터
Expand All @@ -32,14 +32,19 @@ const VoteDetailPage = () => {
const [voteMax, setVoteMax] = useState<any>();
const token = api.getToken();
const groupIdData = useRecoilValue(groupIdAtom);
const groupAdminId = useRecoilValue(groupAdminIdAtom);
// const groupAdminId = useRecoilValue(groupAdminIdAtom);
const groupAdminId = typeof window !== 'undefined' ? sessionStorage.getItem('adminId') : null;

const response = useGetGroupVote(token, groupIdData.groupId);
const currentId = api.getEmail();
const voteP: voteSelectPlaceData = {
groupId: groupIdData.groupId,
bestPlaceIds: votePlaceIds,
};

useEffect(() => {
// eslint-disable-next-line react-hooks/exhaustive-deps
votePlaceIds = [];
}, []);
//투표 데이터 voteData 변수에 저장하기
useEffect(() => {
if (response.data?.message === '성공') setVoteData(response.data?.data);
Expand All @@ -52,7 +57,7 @@ const VoteDetailPage = () => {
setVoteEndAt(changeDate);
}, [voteData?.endAt]);

//재투표 버튼 눌렀을 때 체크한 데이터 저장하기
//보류 --- 재투표 버튼 눌렀을 때 체크한 데이터 저장하기
useEffect(() => {
const temp = voteData?.voteStatuses.filter((item) => item.isVoted);
temp?.map((item) => votePlaceIds.push(item.bestPlaceId));
Expand All @@ -68,6 +73,9 @@ const VoteDetailPage = () => {
console.log('voteMax is...', voteMax);
}, [voteData?.isClosed, voteData?.voteStatuses, voteMax]);

useEffect(() => {
console.log('voteIDS... : ', votePlaceIds);
}, [votePlaceIds]);
//투표 참여 API react-query mutation
const postGroupVoteSelectMutation = useMutation((data: VoteSelectData) => postGroupVoteSelect(token, data), {
onSuccess: () => {
Expand Down

0 comments on commit 7a595ef

Please sign in to comment.