:recycle: [Refactor] EndpointStorage: clear log, and typo
Browse files
storages/endpoint_storage.js
CHANGED
@@ -18,8 +18,10 @@ class EndpointStorage {
|
|
18 |
});
|
19 |
}
|
20 |
clear_database() {
|
|
|
|
|
|
|
21 |
this.db.endpoints.clear();
|
22 |
-
console.log("endpoints cleared.");
|
23 |
}
|
24 |
async load_local_endpoints() {
|
25 |
fetch("/endpoints")
|
@@ -31,7 +33,7 @@ class EndpointStorage {
|
|
31 |
}
|
32 |
let count = Object.keys(data).length;
|
33 |
console.log(`${count} local endpoints loaded.`);
|
34 |
-
// data is array of
|
35 |
// - `endpoint`, `api_key`, `api_type`, `need_protect`
|
36 |
// add these to db.endpoints
|
37 |
data.forEach((endpoint) => {
|
|
|
18 |
});
|
19 |
}
|
20 |
clear_database() {
|
21 |
+
this.db.endpoints.count((count) => {
|
22 |
+
console.log(`${count} endpoints would be cleared.`);
|
23 |
+
});
|
24 |
this.db.endpoints.clear();
|
|
|
25 |
}
|
26 |
async load_local_endpoints() {
|
27 |
fetch("/endpoints")
|
|
|
33 |
}
|
34 |
let count = Object.keys(data).length;
|
35 |
console.log(`${count} local endpoints loaded.`);
|
36 |
+
// data is array of endpoint items, each item has 4 keys:
|
37 |
// - `endpoint`, `api_key`, `api_type`, `need_protect`
|
38 |
// add these to db.endpoints
|
39 |
data.forEach((endpoint) => {
|