File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ export class App extends LitElement {
76
76
@state ( )
77
77
records : ExceptionListEntry [ ] = [ ] ;
78
78
79
+ @state ( )
80
+ loading : boolean = true ;
81
+
79
82
// Holds error message if fetching records fails.
80
83
@state ( )
81
84
error : string | null = null ;
@@ -118,6 +121,7 @@ export class App extends LitElement {
118
121
*/
119
122
async init ( ) {
120
123
try {
124
+ this . loading = true ;
121
125
this . records = await fetchRecords ( RS_ENDPOINTS [ this . rsEnv ] ) ;
122
126
123
127
// Spot check if the format is as expected.
@@ -130,6 +134,8 @@ export class App extends LitElement {
130
134
this . error = null ;
131
135
} catch ( error : any ) {
132
136
this . error = error ?. message || "Failed to initialize" ;
137
+ } finally {
138
+ this . loading = false ;
133
139
}
134
140
}
135
141
@@ -150,6 +156,10 @@ export class App extends LitElement {
150
156
return html `< div class ="error "> Error while processing records: ${ this . error } </ div > ` ;
151
157
}
152
158
159
+ if ( this . loading ) {
160
+ return html `< div > Loading...</ div > ` ;
161
+ }
162
+
153
163
if ( this . records . length === 0 ) {
154
164
return html `< div > No records found.</ div > ` ;
155
165
}
You can’t perform that action at this time.
0 commit comments