Skip to content

Commit

Permalink
Revert "feat(httpstatus): support exposing http status of airport cod…
Browse files Browse the repository at this point in the history
…e image URL"

This reverts commit 18edec3.
  • Loading branch information
jason-capsule42 committed Jan 21, 2022
1 parent f24e285 commit 44da0a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Custom element for the purpose of displaying an avatar image.
| `alt` | `alt` | `String` | "" | provide string for element alt text |
| `ariaVisible` | `ariaVisible` | `Boolean` | null | true value reveals content to screen reader |
| `code` | `code` | `String` | | provide airport code for requested airport image |
| `httpStatus` | `httpStatus` | `String` | null | provides the http status code for the initially declared airport code |
| `img` | `img` | `String` | | provide location or URL for image to be used |
| `tail` | `tail` | `String` | | provide tail logo for requested airline |
| `type` | `type` | `String` | | modifiers for size of avatar (sm \| md) |
15 changes: 2 additions & 13 deletions src/auro-avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import styleCss from "./style-css.js";
* @attr {Boolean} ariaVisible - true value reveals content to screen reader
* @attr {String} alt - provide string for element alt text
* @attr {String} code - provide airport code for requested airport image
* @attr {String} httpStatus - provides the http status code for the initially declared airport code
* @attr {String} img - provide location or URL for image to be used
* @attr {String} tail - provide tail logo for requested airline
* @attr {String} type - modifiers for size of avatar (sm | md)
Expand All @@ -36,7 +35,6 @@ class AuroAvatar extends LitElement {

this.alt = ``;
this.ariaVisible = null;
this.httpStatus = null;
}

// function to define props used within the scope of this component
Expand Down Expand Up @@ -64,10 +62,6 @@ class AuroAvatar extends LitElement {
},
type: {
type: String
},
httpStatus: {
type: String,
reflect: true
}
};
}
Expand Down Expand Up @@ -115,21 +109,16 @@ class AuroAvatar extends LitElement {
* @returns {number} - Returns an http status code.
*/
urlStatus(url) {
let statusCode = null;

try {
const http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
statusCode = http.status;
return http.status;
} catch (err) {
// if the http.send() fails for any reason return `404` code
const errorCode = 404;
statusCode = errorCode;
return errorCode;
}

this.httpStatus = statusCode;
return statusCode;
}

/**
Expand Down

0 comments on commit 44da0a1

Please sign in to comment.