Skip to content

Commit

Permalink
[fix] 뒤로가기 활성화 , 새로운 활동 추천 요청할때 남아있던 spareTime 초기화 (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoyeongJeon authored Nov 27, 2024
1 parent 0a8a681 commit 13c63d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/home/sg-activity/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ export default function SuggestActivity() {
const [selectedActivity, setSeletedActivity] = useState<ActivityData>()
const [activityLink, setActivityLink] = useState('')
const [postActivityType, setPostActivityType] = useState('')
const { spareTime, address } = useActivityStore()
const { spareTime, setSpareTime, address } = useActivityStore()
const router = useRouter()

const handleBack = () => {
if (step === 1) {
setSpareTime('')
router.push('/home')
return
}

setStep((prevStep) => {
if (prevStep === 4 && !selectOnOff.includes('오프라인')) {
return 2
}

return Math.max(prevStep - 1, 1)
})
}
Expand Down Expand Up @@ -84,7 +91,6 @@ export default function SuggestActivity() {
}

const progressBarWidth = `${(step / 4) * 100}%`

return (
<div className="w-full h-screen overflow-hidden">
<HeaderWithBack onBack={handleBack} title="활동 추천받기">
Expand Down

0 comments on commit 13c63d0

Please sign in to comment.