Skip to content

Commit

Permalink
fix: undefined text bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cdransf committed Feb 29, 2024
1 parent 0d12290 commit be08c5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class ApiText extends HTMLElement {
const cacheKey = this.url || 'api-text-cache'
const cache = sessionStorage?.getItem(cacheKey) || loading.innerHTML
const loadText = (string) => {
if (typeof string === 'undefined') {
loading.style.display = 'none'
content.style.display = 'none'
}

if (string && content.style.opacity !== '1') {
loading.style.opacity = '0'
loading.style.display = 'none'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cdransf/api-text",
"version": "1.1.0",
"version": "1.1.1",
"description": "A web component to load text from an API and display it.",
"main": "api-text.js",
"repository": {
Expand Down

0 comments on commit be08c5c

Please sign in to comment.