Closed andluc21 closed 1 year ago
Its a good question! I was kind of thrown for a loop with this task because the api endpoint for the tasks isnt working completely so this PR creates a resource and the task complete is a 201 resource creation message. It's set up to make a POST and should be going to the endpoint when its hooked up properly. Toddy recommended I make the dynamic part of the URL of the API handled directly in the JS so I just focused on that, I suppose this PR is sort of dependent on another task and might need some updating after that.
resolve #193
This feature adds a form that allows the creation of a new task based on a given user. This added feature takes the form data except the User ID and creates corresponding JSON (using JS code) and passes this JSON as a body of the request to the API endpoint. The userId is implemented into the link - it is a dynamic of the API URL Endpoint of the API that is handled in CreateTask.js
Testing
https://nsc-fun-dev-usw2-thursday.azurewebsites.net/api/users/1/tasks
but I believe there is possibly a bug with this link as any number the user input is, the same two users show on the screen. Eventually this link should have create user input functionality for the userId if this is further developed.Troubleshooting Tips
There are 2 outputs from the console when creating a task, The first number is the userID that the task is going towards and the second field is the task in JSON format. If these two dont show up it can be linked back to this functions and if a error shows up when creating the task there is a number that will indicate where the error should be.