utils/request
- Source:
Methods
(static) checkSession(response, session) → {response}
- Description:
Open session expired modal
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
response |
object | |
session |
boolean |
Returns:
response
- Type
- response
(static) checkStatus(response) → {response|Error}
- Description:
Checks if a network request came back fine, and throws an error if not
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
response |
object | A response from a network request |
Returns:
Returns either the response, or throws an error
- Type
- response | Error
(static) exports.requestGet(url, session) → {response}
- Description:
Requests a URL, returning a promise
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The URL we want to request |
session |
boolean | Indicates is check session using in that API |
Returns:
The response data
- Type
- response
(static) exports.requestGetDownloadedFile(url, session) → {response}
- Description:
Requests a URL, returning a promise
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The URL we want to request |
session |
boolean | Indicates is check session using in that API |
Returns:
The response data
- Type
- response
(static) exports.requestPost(url, data, session) → {response}
- Description:
Requests a URL, returning a promise
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The URL we want to request |
data |
object | The data we want to pass to API |
session |
boolean | Indicates is check session using in that API |
Returns:
The response data
- Type
- response
(static) parseJSON(response) → {response}
- Description:
Parses the JSON returned by a network request
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
response |
object | A response from a network request |
Returns:
The parsed JSON from the request
- Type
- response
Type Definitions
error
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
code |
number | |
message |
string |
Type:
- object
response
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
status |
number | Represent boolean, -1 is error, 1 is success |
error |
error | Only exist when status is -1 |
data |
object | Only exist when status is 1 |
Type:
- object