IO-1211 Feature Restrictions
This commit is contained in:
@@ -7,12 +7,18 @@ import { setBodyshop } from "../../redux/user/user.actions";
|
||||
import TechPage from "./tech.page.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBodyshop: (bs) => dispatch(setBodyshop(bs)),
|
||||
});
|
||||
|
||||
export function TechPageContainer({ setBodyshop, match }) {
|
||||
export function TechPageContainer({ bodyshop, setBodyshop, match }) {
|
||||
const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
|
||||
fetchPolicy: "network-only",
|
||||
});
|
||||
@@ -21,10 +27,10 @@ export function TechPageContainer({ setBodyshop, match }) {
|
||||
if (data) setBodyshop(data.bodyshops[0]);
|
||||
}, [data, setBodyshop]);
|
||||
|
||||
if (loading)
|
||||
if (loading || !bodyshop)
|
||||
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
return <TechPage match={match} />;
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)(TechPageContainer);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(TechPageContainer);
|
||||
|
||||
Reference in New Issue
Block a user