Skip to content

Commit

Permalink
delete favorites
Browse files Browse the repository at this point in the history
  • Loading branch information
Ko71k committed Nov 25, 2024
1 parent 2220635 commit d78a0a2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions public/components/EventContentPage/EventContentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ export class EventContentPage {
try {
const response = await api.delete(path, request);
} catch (error) {
navigate('/login');
console.log(error);
}
}
else {
const path = `/profile/subscribe/${event.author}`;
try {
const response = await api.post(path, request);
} catch (error) {
navigate('/login');
console.log(error);
}
}
});
Expand Down Expand Up @@ -222,16 +222,19 @@ export class EventContentPage {
},
credentials: 'include',
};
const path = `/events/favorites/${event.id}`;
try {
if (isFavorite) {
const path = `/events/favorites/${event.id}`;
const response = await api.delete(path, request);
isFavorite = isFavorite^1;
} else {
const response = await api.post(path, request);
const path = `/events/favorites/${event.id}`;
const response = await api.post(path, request);
isFavorite = isFavorite^1;
}

} catch (error) {
navigate('/login');
console.log(error);
}
});
if (possession > 0) {
Expand Down

0 comments on commit d78a0a2

Please sign in to comment.