mirror of https://github.com/morpheus65535/bazarr
no log: Remove useSessionStorage from utility hooks
This commit is contained in:
parent
ac8f5c0ca5
commit
8d447453e9
|
@ -1,4 +1,4 @@
|
||||||
import React, { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { useHistory } from "react-router";
|
import { useHistory } from "react-router";
|
||||||
import { useDidUpdate } from "rooks";
|
import { useDidUpdate } from "rooks";
|
||||||
import { getBaseUrl } from ".";
|
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(
|
export function useOnLoadingFinish(
|
||||||
state: Readonly<AsyncState<any>>,
|
state: Readonly<AsyncState<any>>,
|
||||||
callback: () => void
|
callback: () => void
|
||||||
|
|
Loading…
Reference in New Issue