antos-frontend/src/core/api.coffee

24 lines
651 B
CoffeeScript
Raw Normal View History

2017-08-07 00:49:24 +02:00
self.OS.API =
# the handler object could be a any remote or local handle to
# fetch user data, used by the API to make requests
# handlers are defined in /src/handlers
handler: new Object()
#request a user data
request: (query, callback) ->
2017-08-07 00:49:24 +02:00
# definition here
handle.request query, callback
2017-08-07 00:49:24 +02:00
systemConfig: ->
_API.request 'config', (result) ->
console.log result
get: (p, c, f) ->
$.get p
.done (data) -> c(data)
.fail -> f()
resource: (resource, callback) ->
2017-08-11 01:58:46 +02:00
path = "resources/#{resource}"
_API.get path, callback
2017-08-11 01:58:46 +02:00