diff --git a/client/ui/timeline.js b/client/ui/timeline.js index bf8d94d0..a4389020 100644 --- a/client/ui/timeline.js +++ b/client/ui/timeline.js @@ -18,6 +18,14 @@ function personByInstagram(list, instagram){ } } +function postText(post){ + try{ + return post.data.caption.text.replace(/#[\w_]+/, "") + }catch(error){ + return ""; + } +} + module.exports = function(app) { app.directive("timeline", function (team) { return { @@ -36,13 +44,14 @@ module.exports = function(app) { $scope.feed = list.map(function (post) { var author_id = personByInstagram(team.team, post.data.user.username); var name = author_id ? team.short(author_id) : post.data.user.username; + return { date: post.publishDate, image: post.data.images.standard_resolution.url, url: post.data.link, username: name, userpic: post.data.user.profile_picture, - text: post.data.caption.text.replace(/#[\w_]+/, "") + text: postText(post) }; }); }); diff --git a/routers/instagram.js b/routers/instagram.js index 2b6c6862..3914225f 100644 --- a/routers/instagram.js +++ b/routers/instagram.js @@ -3,15 +3,13 @@ */ var Router = require("express").Router; -var instagram = require("./instagram"); +var instagram = require("../core/instagram"); module.exports = function (app) { var router; router = new Router(); router.route("/auth/instagram/callback") .get(function (req, res) { - var api = instagram.client(); - var code = req.query.code; instagram.authorize(code) .catch(function(error){