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
1 changed files with 1 additions and 17 deletions

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