Module: services/api

Methods

Add link of the API to the app content

Parameters:
Name Type Description
url string

root of the API

Source:
See:

(inner) apiAjaxHandler(url, action)

API request

Parameters:
Name Type Description
url string

root of the API

action string

name of the action to execute

Source:
See:

(inner) handleJSONResponse(response) → {Promise}

Parse a JSON response and reject if not ok

Parameters:
Name Type Description
response Response

fetch response object

Source:
Returns:

returns the parsed JSON or a rejected promise

Type
Promise

(inner) handleResponse(response) → {Promise}

Route the response to the correct handler based on content type

Parameters:
Name Type Description
response Response

fetch response object

Source:
Returns:

returns the parsed response

Type
Promise

(inner) handleTextResponse(response) → {Promise}

Parse a text response and reject if not ok

Parameters:
Name Type Description
response Response

fetch response object

Source:
Returns:

returns the parsed text or a rejected promise

Type
Promise