Skip to content

Commit

Permalink
add jsdoc for Response class
Browse files Browse the repository at this point in the history
  • Loading branch information
rockwellll committed Jan 11, 2025
1 parent 289ad1e commit d63d30c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/api/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,34 @@ class Response {
this.#success = success
}

/**
* Get the response data
* @returns {*}
*/
get data() {
return this.response
}

/**
* Parse the response as JSON
* @returns {Promise<*>}
*/
async json() {
return await this.response.json()
}

/**
* Has the request failed?
* @returns {boolean}
*/
get failed() {
return this.#success === false
}

/**
* Has the request succeeded?
* @returns {boolean}
*/
get succeeded() {
return this.#success === true
}
Expand Down

0 comments on commit d63d30c

Please sign in to comment.