Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Sep 9, 2024
1 parent 85b08e2 commit 98137aa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pageTemplates/vote/VoteDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
import BottomDrawerLg from "../../components/organisms/drawer/BottomDrawerLg";
import { STUDY_PREFERENCE_LOCAL } from "../../constants/keys/queryKeys";
import { useStudyPreferenceQuery } from "../../hooks/study/queries";
import { StudyVoteMapActionType } from "../../pages/vote";
import { PreferStorageProps, StudyVoteMapActionType } from "../../pages/vote";
import { DispatchType } from "../../types/hooks/reactTypes";
import { IParticipation, IPlace } from "../../types/models/studyTypes/studyDetails";
import {
Expand Down Expand Up @@ -33,16 +33,16 @@ function VoteDrawer({ studyVoteData, myVote, setMyVote, setActionType }: VoteDra
const preferenceStorage = localStorage.getItem(STUDY_PREFERENCE_LOCAL);

const { data: studyPreference } = useStudyPreferenceQuery({
enabled: !preferenceStorage,
onSuccess(data) {
localStorage.setItem(STUDY_PREFERENCE_LOCAL, JSON.stringify(data));
enabled: !preferenceStorage || preferenceStorage === "undefined",
onSuccess() {
setMyVote(null);
},
});

const savedPrefer = preferenceStorage
? (JSON.parse(preferenceStorage) as IStudyVotePlaces)
: studyPreference;
console.log(preferenceStorage);
const savedPrefer =
preferenceStorage && preferenceStorage !== "undefined"
? (JSON.parse(preferenceStorage) as PreferStorageProps)?.prefer
: studyPreference;

const savedPreferPlace: { place: IPlace; subPlace: IPlace[] } = savedPrefer && {
place: studyVoteData.find((par) => par.place._id === savedPrefer.place)?.place,
Expand Down

0 comments on commit 98137aa

Please sign in to comment.