Remove unused KVStore
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
632905f591
commit
b89ea15cfa
2 changed files with 0 additions and 29 deletions
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import KVStore from 'bigbuffet/storage/kv-store';
|
|
||||||
import sourceCode from 'bigbuffet/utils/code';
|
import sourceCode from 'bigbuffet/utils/code';
|
||||||
|
|
||||||
interface ISiteErrorBoundary {
|
interface ISiteErrorBoundary {
|
||||||
|
@ -14,7 +13,6 @@ const SiteErrorBoundary: React.FC<ISiteErrorBoundary> = ({ children }) => {
|
||||||
const clearCookies: React.MouseEventHandler = (e) => {
|
const clearCookies: React.MouseEventHandler = (e) => {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
sessionStorage.clear();
|
sessionStorage.clear();
|
||||||
KVStore.clear();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fallback = (
|
const fallback = (
|
||||||
|
|
|
@ -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;
|
|
Loading…
Reference in a new issue