mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-11-14 17:35:35 +01:00
fixup! Add CustomizationContext and custom hook
This commit is contained in:
parent
2bbdda566c
commit
3fc1388a9f
|
@ -11,6 +11,8 @@ import PropTypes from "prop-types";
|
|||
import { useAPIGet } from "../api/hooks";
|
||||
import { ForisURLs } from "../utils/forisUrls";
|
||||
|
||||
import { Spinner } from "../bootstrap/Spinner";
|
||||
|
||||
CustomizationContextProvider.propTypes = {
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
|
@ -28,6 +30,10 @@ function CustomizationContextProvider({ children }) {
|
|||
getCustomization();
|
||||
}, [getCustomization]);
|
||||
|
||||
if (getCustomizationResponse.state !== "success") {
|
||||
return <Spinner fullScreen />;
|
||||
}
|
||||
|
||||
const deviceDetails = getCustomizationResponse.data || {};
|
||||
|
||||
const isCustomized = !!(
|
||||
|
@ -37,7 +43,7 @@ function CustomizationContextProvider({ children }) {
|
|||
);
|
||||
|
||||
return (
|
||||
<CustomizationContext.Provider value={isCustomized}>
|
||||
<CustomizationContext.Provider value={{ deviceDetails, isCustomized }}>
|
||||
{children}
|
||||
</CustomizationContext.Provider>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user