diff --git a/src/routes/_pages/matches/index.html b/src/routes/_pages/matches/index.html index 47bb7b0b..0e2ecb00 100644 --- a/src/routes/_pages/matches/index.html +++ b/src/routes/_pages/matches/index.html @@ -1,20 +1,4 @@ - - +
+
diff --git a/static/fedilove-no-react.js b/static/fedilove-no-react.js index be37b5b4..9ec3fbae 100644 --- a/static/fedilove-no-react.js +++ b/static/fedilove-no-react.js @@ -8,12 +8,13 @@ const fediloveMastodon = { request: function(method, path, payload, callbk) { payload = payload || null; + callbk = callbk || null; const ACCESS_TOKEN = window.fediloveApi.getAccessToken(); if (ACCESS_TOKEN === undefined) return callbk(undefined); const API_URL = 'https://'+fediloveApi.getCurrentInstance()+path; const oReq = new XMLHttpRequest(); - oReq.addEventListener("load", function() { callbk(this.responseText); }); + oReq.addEventListener("load", function() { if (callbk) callbk(this.responseText) }); oReq.open(method, API_URL); oReq.setRequestHeader('Authorization', 'Bearer '+ACCESS_TOKEN); oReq.send(payload); @@ -27,15 +28,27 @@ const fediloveMastodon = { API: { discardAccount: function(account_id, cback) { fediloveMastodon.post(`/api/v1/accounts/${account_id}/block`, null, function(data) { cback() }); + fediloveMastodon.post(`/api/v1/follow_requests/${account_id}/reject`); }, matchAccount: function(account_id, cback) { - fediloveMastodon.post(`/api/v1/accounts/${account_id}/follow`, {'reblogs': true}, - function(data) { cback() } - ); + fediloveMastodon.post(`/api/v1/accounts/${account_id}/follow`, {'reblogs': true}, function(data) { cback() }); + fediloveMastodon.post(`/api/v1/follow_requests/${account_id}/authorize`); }, getRelationship: function(account_id, cback) { fediloveMastodon.get(`/api/v1/accounts/relationships?id=${account_id}`, null, cback); }, + getMyFollowing: function(cback) { + fediloveMastodon.get(`/api/v1/accounts/${fediloveData.myAccountId}/following`, null, cback); + }, + getMyRequestsToFollow: function(cback) { + // to-do: find out how to list my own matches (follow requests) + }, + getMyFollowers: function(cback) { + fediloveMastodon.get(`/api/v1/accounts/${fediloveData.myAccountId}/followers`, null, cback); + }, + getRequestsToFollowMe: function(cback) { + fediloveMastodon.get('/api/v1/follow_requests', null, cback); + }, statusFav: function(dom, status_id) { var dislike = false; var path = `/api/v1/statuses/${status_id}/favourite`;