forked from chookspace/chookchat
view specific posts
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
function like(id) {
|
||||
|
||||
async function like(id) {
|
||||
const usernameBox = document.getElementById('username');
|
||||
const passwordBox = document.getElementById('password');
|
||||
|
||||
@@ -8,8 +7,12 @@ function like(id) {
|
||||
formData.append('password', passwordBox.value);
|
||||
formData.append('post', id);
|
||||
|
||||
fetch('/like', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
const result = await fetch('/like', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
||||
if (result.status < 200 || result.status >= 400) {
|
||||
alert("your post didnt get the like because the server thought your opinion was invalid");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user