diff --git a/src/client/api/APIGallery.js b/src/client/api/APIGallery.js new file mode 100644 index 00000000..262edecc --- /dev/null +++ b/src/client/api/APIGallery.js @@ -0,0 +1,16 @@ +/** + * Created by tmshv on 22/11/14. + */ + +import EndPoint from './EndPoint'; + +export default class APIGallery extends EndPoint { + year(year) { + return this.request.get(`/gallery/${year}`, {cache: true}); + } + + album(year, course, album) { + let url = `/gallery/${year}/${course}/${album}`; + return this.request.get(url, {cache: true}); + } +} diff --git a/src/client/api/api.js b/src/client/api/api.js index 0c53d605..d31dc0d1 100644 --- a/src/client/api/api.js +++ b/src/client/api/api.js @@ -3,7 +3,7 @@ */ import APIFeed from './APIFeed'; -var APIGallery = require("./gallery"); +import APIGallery from './APIGallery'; import APIDocument from './APIDocument'; module.exports = function (app) { @@ -12,7 +12,7 @@ module.exports = function (app) { app.factory("api", function ($http) { var api = {}; api.news = new APIFeed($http); - api.gallery = new APIGallery($http, minute); + api.gallery = new APIGallery($http); api.document = new APIDocument($http); return api; diff --git a/src/client/api/gallery.js b/src/client/api/gallery.js deleted file mode 100644 index 0016adbd..00000000 --- a/src/client/api/gallery.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Created by tmshv on 22/11/14. - */ - -function APIGallery(http){ - this.request = http; -} - -APIGallery.prototype.year = function(year) { - return this.request.get("/gallery/" + year, {cache: true}); -}; - -APIGallery.prototype.album = function(year, course, album) { - var url = '/gallery/{year}/{course}/{album}' - .replace('{year}', year) - .replace('{course}', course) - .replace('{album}', album); - - return this.request.get(url, {cache: true}); -}; - -module.exports = APIGallery; \ No newline at end of file