Added vehicle and owner pages/routes.
This commit is contained in:
@@ -1,6 +1,34 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import ManagePage from "./manage.page";
|
||||
import { useQuery } from "react-apollo";
|
||||
import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
|
||||
import { setBodyshop } from "../../redux/user/user.actions";
|
||||
import { connect } from "react-redux";
|
||||
import { notification } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function ManagePageContainer() {
|
||||
return <ManagePage />;
|
||||
}
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
setBodyshop: bs => dispatch(setBodyshop(bs))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(function ManagePageContainer({ match, setBodyshop }) {
|
||||
const { error, data } = useQuery(QUERY_BODYSHOP, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
const { t } = useTranslation();
|
||||
if (error) {
|
||||
notification["error"]({ message: t("bodyshop.errors.loading") });
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (data) setBodyshop(data.bodyshops[0]);
|
||||
return () => {
|
||||
//
|
||||
};
|
||||
}, [data]);
|
||||
|
||||
return <ManagePage match={match} />;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user