From e7d8632154a6ebab2a0203f42c44e67c88817e38 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 7 Jan 2018 22:13:15 -0800 Subject: [PATCH] we can fetch timelines! --- routes/_utils/mastodon.js | 11 +++++++++++ routes/index.html | 20 ++++++++++++++++++-- routes/settings/add-instance.html | 3 ++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/routes/_utils/mastodon.js b/routes/_utils/mastodon.js index e70a82b8..880c3ede 100644 --- a/routes/_utils/mastodon.js +++ b/routes/_utils/mastodon.js @@ -48,4 +48,15 @@ export function getAccessTokenFromAuthCode(instanceName, clientId, clientSecret, code: code }) }) +} + +export function getHomeTimeline(instanceName, accessToken) { + let url = `https://${instanceName}/api/v1/timelines/home` + return fetch(url, { + method: 'GET', + headers: { + 'Accept': 'application/json', + 'Authorization': `Bearer ${accessToken}` + } + }) } \ No newline at end of file diff --git a/routes/index.html b/routes/index.html index 517058d0..d3266a6c 100644 --- a/routes/index.html +++ b/routes/index.html @@ -15,13 +15,29 @@