mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 01:02:19 +00:00
no log: Remove useSessionStorage from utility hooks
This commit is contained in:
parent
ac8f5c0ca5
commit
8d447453e9
1 changed files with 1 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { useCallback, useMemo } from "react";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useHistory } from "react-router";
|
||||
import { useDidUpdate } from "rooks";
|
||||
import { getBaseUrl } from ".";
|
||||
|
@ -28,22 +28,6 @@ export function useHasUpdateInject() {
|
|||
}
|
||||
}
|
||||
|
||||
export function useSessionStorage(
|
||||
key: string
|
||||
): [StorageType, React.Dispatch<StorageType>] {
|
||||
const dispatch: React.Dispatch<StorageType> = useCallback(
|
||||
(value) => {
|
||||
if (value !== null) {
|
||||
sessionStorage.setItem(key, value);
|
||||
} else {
|
||||
sessionStorage.removeItem(key);
|
||||
}
|
||||
},
|
||||
[key]
|
||||
);
|
||||
return [sessionStorage.getItem(key), dispatch];
|
||||
}
|
||||
|
||||
export function useOnLoadingFinish(
|
||||
state: Readonly<AsyncState<any>>,
|
||||
callback: () => void
|
||||
|
|
Loading…
Reference in a new issue