Following up on the work from issue #294, this task finishes the story token logic at least on the posting-stories aspect of the website. With the frontend components now in place, we can proceed with the backend functionality of the newly added components.
1) Recall that if the user chooses the option that they already have a token, then an input field appears, prompting the user to type their token. We need to add some logic (executed after the user hits the final submit button) which checks if the inputted token is valid. Valid in this context means that the token exists in the database.
If the given token by the user does not exist, then an error message should be displayed that tells the user that the token they gave was not valid. The message should also specify that if they do not have a token, they should choose the other option.
If the token was valid, then it should proceed with the submission process and the new story should appear in the database. It should also update the relationship between this token and the existing and new story that was added (i.e. make sure the new story id is added to the list that references the stories that are tied to this token).
2) If the user chooses to make a new token, the generated token should be unique (i.e. not already existing in the database). When the user submits their story, this token should be tied to the newly created story (see the schema to see more about what this means).
Following up on the work from issue #294, this task finishes the story token logic at least on the posting-stories aspect of the website. With the frontend components now in place, we can proceed with the backend functionality of the newly added components.
1) Recall that if the user chooses the option that they already have a token, then an input field appears, prompting the user to type their token. We need to add some logic (executed after the user hits the final submit button) which checks if the inputted token is valid. Valid in this context means that the token exists in the database.