Skip to content

Commit

Permalink
Update CreateProgramModal.component.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
sametaln committed Oct 21, 2024
1 parent 6134eed commit 2a940d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/CreateProgramModal.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import { useContext } from 'react'
import { PostContext } from '../context/PostContext'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { muscleGroups, locationType, programTypes } from '../constants/program'
import { UserContext } from '../context/UserContext'

function CreateProgramModal({
isOpen,
onClose
}) {
const profile = useSelector(userProfile)
const password = useSelector(userPassword)
const sessionToken = useSelector(userSessionToken)

Expand All @@ -51,6 +51,8 @@ function CreateProgramModal({
const [exerciseReps, setExerciseReps] = useState('')
const [exerciseMuscleGroup, setExerciseMuscleGroup] = useState('')

const { user } = useContext(UserContext)

const {
isOpen: isExerciseModalOpen,
onOpen: onExerciseModalOpen,
Expand Down Expand Up @@ -140,7 +142,7 @@ function CreateProgramModal({
const createProgramMutation = useMutation(
{
mutationFn: async () => {
if (!profile) {
if (!user) {
toast({
title: 'Not logged in.',
description: 'Please log in to create a post.',
Expand Down

0 comments on commit 2a940d4

Please sign in to comment.