File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -116,14 +116,6 @@ export default {
116
116
this .sessionExpiry = null ;
117
117
},
118
118
authenticate : async function () {
119
- if (! this .item .apikey ) {
120
- this .handleError (
121
- " API key is required for PiHole authentication" ,
122
- " disabled" ,
123
- );
124
- return false ;
125
- }
126
-
127
119
try {
128
120
const authResponse = await this .fetch (" /api/auth" , {
129
121
method: " POST" ,
@@ -166,7 +158,7 @@ export default {
166
158
},
167
159
fetchStatus: async function () {
168
160
try {
169
- if (! this .isAuthenticated ) {
161
+ if (! this .isAuthenticated && this . item . apikey ) {
170
162
const authenticated = await this .authenticate ();
171
163
if (! authenticated) return ;
172
164
}
@@ -182,10 +174,8 @@ export default {
182
174
this .percent_blocked = response .queries .percent_blocked ;
183
175
this .retryCount = 0 ;
184
176
} catch (e) {
185
- if (
186
- e .message .includes (" 401 error" ) ||
187
- e .message .includes (" 403 error" )
188
- ) {
177
+ const isAuthError = e .message .includes (" 401 error" ) || e .message .includes (" 403 error" );
178
+ if (isAuthError && this .item .apikey ) {
189
179
this .removeCacheSession ();
190
180
return this .retryWithDelay ();
191
181
}
You can’t perform that action at this time.
0 commit comments