1
0
Fork 0
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:
LASER-Yi 2021-06-10 10:20:23 +08:00
parent ac8f5c0ca5
commit 8d447453e9

View file

@ -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