Add schema utils
This commit is contained in:
parent
c8a729f8be
commit
b26466e59d
45 changed files with 674 additions and 151 deletions
|
@ -62,6 +62,7 @@ import { ToastType } from '../types/Toast';
|
|||
import { AbortableProcess } from '../util/AbortableProcess';
|
||||
import type { WebAPICredentials } from './Types';
|
||||
import { NORMAL_DISCONNECT_CODE } from './SocketManager';
|
||||
import { parseUnknown } from '../util/schemas';
|
||||
|
||||
const THIRTY_SECONDS = 30 * durations.SECOND;
|
||||
|
||||
|
@ -107,7 +108,7 @@ export namespace AggregatedStats {
|
|||
try {
|
||||
const json = localStorage.getItem(key);
|
||||
return json != null
|
||||
? AggregatedStatsSchema.parse(JSON.parse(json))
|
||||
? parseUnknown(AggregatedStatsSchema, JSON.parse(json) as unknown)
|
||||
: createEmpty();
|
||||
} catch (error) {
|
||||
log.warn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue