Add basic pages.meet action.crush() support

This commit is contained in:
Niko 2022-02-17 02:00:50 +01:00
parent 794fc1ea39
commit 34d481ea77
2 changed files with 14 additions and 1 deletions

View File

@ -95,6 +95,19 @@ app.pages.meet = {
} else index = 0;
app.pages.meet.carousel.set(parseInt(index));
},
actions: {
crush: function() {
const current = app.pages.meet.dataCurrent();
if (current === null)
return console.error('TODO: add-to-toast: notify user an unknown error')
http.post(`/api/v1/accounts/follow?url=${current.account.url}`, {}, function(json) {
if (json.error !== undefined)
console.error('TODO: add-to-toast: notify user an unknown error')
else if (json.result !== undefined && json.result === 1)
console.log('TODO: add-to-toast: crush was marked succesfully!')
})
},
},
exit: function() {
window.location.href = '#';
app.overlay.hideAll();

View File

@ -9,7 +9,7 @@
</div>
</a>
<a class="component icon button light round" title="{s:alt.nav_crush}"
href="javascript:app.pages.meet.crush()">
href="javascript:app.pages.meet.actions.crush()">
<div class="ic-container flex">
<i class="center fa fa-heart fa-fw"></i>
</div>