Closed DagemBefikadu closed 2 years ago
I can successfully post a comment but i cant see it in the campaign array
export default function NewComment(props) { const [addComment, setAddComment] = useState([]) let newParam = useParams() const createdComment = (e) => { e.preventDefault() console.log("this is params:", props.user._id) axios({ url: apiUrl + `/campaigns/${newParam}/comments`, method: "POST", headers: { Authorization: `Token token=${props.user.token}`, }, data: { comment: { commented: e.target.newComment.value, campaignId: newParam.id, owner: props.user._id } } }) .then((res) => console.log("server response:", res)) .catch((err) => console.log(err)); }
I feel like i need another then statment
Show me the model for comment and the route used to add them
What's the update on this?
Solved!
What stack are you using?
(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)
What's the problem you're trying to solve?
I can successfully post a comment but i cant see it in the campaign array
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
What is your best guess as to the source of the problem?
I feel like i need another then statment
What things have you already tried to solve the problem?