diff --git a/forms-flow-web/src/components/App.jsx b/forms-flow-web/src/components/App.jsx index a62d7a9d8..66176b2bb 100644 --- a/forms-flow-web/src/components/App.jsx +++ b/forms-flow-web/src/components/App.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React,{useState, useEffect} from "react"; import PropTypes from "prop-types"; import { Provider } from "react-redux"; import { ConnectedRouter } from "connected-react-router"; @@ -12,10 +12,18 @@ import { QueryClientProvider, } from 'react-query'; const queryClient = new QueryClient(); +import { HelperServices } from '@formsflow/service'; + const App = React.memo((props) => { const { store, history, publish, subscribe, getKcInstance } = props; + const [isPreviewRoute,setIsPreviewRoute] = useState(false); + useEffect(()=> { + const location = window.location.pathname; + const viewOnlyRoutes = new Set (["view-edit"]); + setIsPreviewRoute(() => HelperServices.isViewOnlyRoute(location,viewOnlyRoutes)); + },[]); return ( -