I am currently working on a simple app to store workout routines in Nuxt 3 and Appwrite. The link to the source code is here.
After logging in and adding in some workouts in the app's UI, whenever I try to call the deleteWorkout
function, I get an error in the console saying that the function is not defined, whereas I have clearly defined in the workoutStore
. I can't seem to figure out the reason for the same.
The same can be seen in the given screenshot.
Console on clicking the delete button
PS:
/pages/workouts.vue
, /components/WorkoutDetails.vue
or /stores/workout.js
.In your code the problem is, you declear your deleteWorkout()
function outside of the actions
block in workout.js
file.
Make sure all your functions in the workout store are inside the actions block. Then it will be accessable from the vue component