diff --git a/src/client/api/APIFeed.js b/src/client/api/APIFeed.js new file mode 100644 index 00000000..741408e5 --- /dev/null +++ b/src/client/api/APIFeed.js @@ -0,0 +1,17 @@ +/** + * Created by tmshv on 22/11/14. + */ + +import {query} from '../../utils/net'; +import EndPoint from './EndPoint'; + +export default class APIFeed extends EndPoint{ + constructor(http){ + super(http) + } + + feed(count, portion) { + let q = query([['count', count], ['portion', portion]]); + return this.request.get(`/news?${q}`); + } +} diff --git a/src/client/api/api.js b/src/client/api/api.js index 96ccdde5..0c53d605 100644 --- a/src/client/api/api.js +++ b/src/client/api/api.js @@ -2,7 +2,7 @@ * Created by tmshv on 22/11/14. */ -var APINews = require("./news"); +import APIFeed from './APIFeed'; var APIGallery = require("./gallery"); import APIDocument from './APIDocument'; @@ -11,7 +11,7 @@ module.exports = function (app) { app.factory("api", function ($http) { var api = {}; - api.news = new APINews($http); + api.news = new APIFeed($http); api.gallery = new APIGallery($http, minute); api.document = new APIDocument($http); diff --git a/src/client/api/news.js b/src/client/api/news.js deleted file mode 100644 index 99690b12..00000000 --- a/src/client/api/news.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Created by tmshv on 22/11/14. - */ - -import {query} from '../../utils/net'; - -function APIFeed(http){ - this.request = http; -} - -APIFeed.prototype.feed = function(count, portion) { - return this.request.get("/news?"+query([["count", count], ["portion", portion]])); -}; - -module.exports = APIFeed; \ No newline at end of file