Skip to content

Commit 6850afa

Browse files
committed
client: More type checking changes
1 parent 1e45cbb commit 6850afa

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

client/js/requests/items.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export function getItems(
161161
}),
162162
abortController,
163163
})
164-
.promise.then((response) => response.json())
164+
.promise.then((response: Response) => response.json())
165165
.then(enrichItemsResponse);
166166
}
167167

client/js/selfoss-base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class selfoss {
198198
this.db.enableOffline.update(enableOffline);
199199
window.localStorage.setItem(
200200
'enableOffline',
201-
this.db.enableOffline.value,
201+
this.db.enableOffline.value.toString(),
202202
);
203203
if (!this.db.enableOffline.value) {
204204
this.db.clear();
@@ -439,7 +439,7 @@ class selfoss {
439439
return Promise.reject(error);
440440
}
441441

442-
const httpCode = error?.response?.status || 0;
442+
const httpCode = 'response' in error ? error.response.status : 0;
443443

444444
if (tryOffline && httpCode != 403) {
445445
return this.db.setOffline();

client/js/selfoss-db-offline.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default class DbOffline {
1515
public newerEntriesMissing: boolean = false;
1616
public shouldLoadEntriesOnline: boolean = false;
1717
public olderEntriesOnline: boolean = false;
18+
public needsSync: boolean;
1819

1920
_tr(...args) {
2021
return selfoss.db.storage.transaction(...args).catch((error) => {
@@ -340,7 +341,11 @@ export default class DbOffline {
340341
reloadOnlineStats() {
341342
return this._tr('r', [selfoss.db.storage.stats], () => {
342343
selfoss.db.storage.stats.toArray((stats) => {
343-
const newStats = {};
344+
const newStats = {
345+
unread: 0,
346+
starred: 0,
347+
total: 0,
348+
};
344349
stats.forEach((stat) => {
345350
newStats[stat.name] = stat.value;
346351
});

client/js/selfoss-db-online.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ResponseItem,
77
StatusUpdate,
88
SyncParams,
9+
SyncResponse,
910
} from './requests/items';
1011

1112
export type FetchParams = {

0 commit comments

Comments
 (0)