Remove unused KVStore

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-29 13:32:31 +01:00
parent 632905f591
commit b89ea15cfa
2 changed files with 0 additions and 29 deletions

View file

@ -2,7 +2,6 @@ import React from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { FormattedMessage } from 'react-intl';
import KVStore from 'bigbuffet/storage/kv-store';
import sourceCode from 'bigbuffet/utils/code';
interface ISiteErrorBoundary {
@ -14,7 +13,6 @@ const SiteErrorBoundary: React.FC<ISiteErrorBoundary> = ({ children }) => {
const clearCookies: React.MouseEventHandler = (e) => {
localStorage.clear();
sessionStorage.clear();
KVStore.clear();
};
const fallback = (

View file

@ -1,27 +0,0 @@
import localforage from 'localforage';
interface IKVStore extends LocalForage {
getItemOrError: (key: string) => Promise<any>;
}
// localForage
// https://localforage.github.io/localForage/#settings-api-config
export const KVStore = localforage.createInstance({
name: 'soapbox',
description: 'Soapbox offline data store',
driver: localforage.INDEXEDDB,
storeName: 'keyvaluepairs',
}) as IKVStore;
// localForage returns 'null' when a key isn't found.
// In the Redux action flow, we want it to fail harder.
KVStore.getItemOrError = (key: string) =>
KVStore.getItem(key).then(value => {
if (value === null) {
throw new Error(`KVStore: null value for key ${key}`);
} else {
return value;
}
});
export default KVStore;