sei-ec-remote / team-project-issues

0 stars 0 forks source link

Unable to updated #153

Closed bruceabrigo closed 1 year ago

bruceabrigo commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

Content not updating on api

What is the problem you are trying to solve?

Updated content should updated content material

Expected behavior A clear and concise description of what you expected to happen.

After inputting new material to edit content form, edit material should patch it's previous value

What is the actual behavior? A clear and concise description of what actually happened.

Received a success message, however no updated actually occured

Post any code you think might be relevant (one fenced block per file) In Show

useEffect(() => {
        showContent(id)
        .then(res => setContent(res.data.content))
        .catch(err => {
            msgAlert({
                heading: 'Error editing post',
                message: messages.editPostFailure,
                variant: 'danger'
            })
        })
    }, [edited])

In Modal

    const onSubmit = (e) => {
        e.preventDefault()

        editPost(user, content)
            .then(() => handleClose())
            .then(() => {
                msgAlert({
                    heading: 'Post saved!',
                    message: messages.editPostSuccess,
                    variant: 'success'
                })
            })
            .then(() => triggerRefresh())
            .catch(() => {
                msgAlert({
                    heading: 'Error with edit',
                    message: messages.editPostFailure,
                    variant: 'danger'
                })
            })
    }

What is your best guess as to the source of the problem?

At first I assumed an incorrect axios call, however after changes the url an error occured. PATCH url works in postman. My best bet is an error in the useEffect

What things have you already tried to solve the problem?

Changed the axios url

Additional context Add any other context about the problem here.

Paste a link to your repository here https://github.com/bruceabrigo/App3-Client/tree/Bruce-Client-D3

asands94 commented 1 year ago

When you refresh the page is the content updated?

bruceabrigo commented 1 year ago

Nothing updates even after the refresh