Skip to content

Commit

Permalink
add type
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Bulat committed Mar 9, 2024
1 parent d4741f1 commit 4973eb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/IntegrityChecks/Local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
defaultCustomNodeUrls,
defaultSearchTerms,
} from 'contexts/ChainFilter/defaults';
import type { RemoveOrSetInput } from './types';

// ------------------------------------------------------
// Tabs.
Expand Down Expand Up @@ -135,13 +136,7 @@ export const performLocalIntegrityChecks = () => {
// Remove or update local data depending on resulting updated state.
export const removeOrSetLocalData = <T>(
key: string,
{
updated,
result,
}: {
updated: boolean;
result: T;
}
{ updated, result }: RemoveOrSetInput<T>
) => {
if (!result || JSON.stringify(result) === '{}') {
localStorage.removeItem(key);
Expand Down
7 changes: 7 additions & 0 deletions src/IntegrityChecks/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2024 @rossbulat/console authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

export interface RemoveOrSetInput<T> {
updated: boolean;
result: T;
}

0 comments on commit 4973eb2

Please sign in to comment.