Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Confirmation Message and Validation #8

Open
BenSpace48 opened this issue Jun 26, 2019 · 0 comments
Open

Add Confirmation Message and Validation #8

BenSpace48 opened this issue Jun 26, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@BenSpace48
Copy link
Member

BenSpace48 commented Jun 26, 2019

Currently if the AJAX request fails when adding a new comment there is no success or error message so the user has no confirmation.

Success message is not required as the user can see the comment on the screen if it succeeds but the user will not be aware if the comment fails, currently it simply logs to the console but we should render a message on the users screen.

There is some validation for comments that are too short (to prevent empty comments being added), so when this validation fails the user should also be shown a message.

See src/components/comment/NewComment.tsx:

if (trimmedComment.length > 2) {
    Axios.post(`${baseUrl()}new.php?commentType=` + props.commentType + '&text=' + comment)
        .then(function (response: InterfaceTeamData) {
            props.updateTeamData(response.data);
            setComment(''); // Reset the comment
        })
        .catch(function (error: Object) {
            console.log(error);
        });
} else {
    console.log('Validation failed');
    // todo: Add validation message
}
@BenSpace48 BenSpace48 self-assigned this Jun 26, 2019
@BenSpace48 BenSpace48 added the enhancement New feature or request label Jun 26, 2019
@BenSpace48 BenSpace48 removed their assignment Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant