Minor adjustments and fixes

This commit is contained in:
Patrick Fic
2020-02-19 13:26:50 -08:00
parent 0b47fb166e
commit faed2c32b6
10 changed files with 95 additions and 52 deletions

View File

@@ -36,8 +36,7 @@ function JobsDetailPageContainer({ match, form }) {
refetch();
})
.catch(error => {
//TODO Error handling.
console.log("error", error);
notification[error]({ message: t("jobs.errors.saving") });
});
};
@@ -70,7 +69,6 @@ function JobsDetailPageContainer({ match, form }) {
notification["success"]({
message: t("jobs.successes.savetitle")
});
//TODO: Better way to reset the field decorators?
refetch().then(r => form.resetFields());
});
}
@@ -78,7 +76,7 @@ function JobsDetailPageContainer({ match, form }) {
};
if (loading) return <SpinComponent />;
if (error) return <AlertComponent message={error.message} type="error" />;
if (error) return <AlertComponent message={error.message} type='error' />;
return data.jobs_by_pk ? (
<JobDetailFormContext.Provider value={form}>
@@ -94,7 +92,7 @@ function JobsDetailPageContainer({ match, form }) {
/>
</JobDetailFormContext.Provider>
) : (
<AlertComponent message={t("jobs.errors.noaccess")} type="error" />
<AlertComponent message={t("jobs.errors.noaccess")} type='error' />
);
}
export default Form.create({ name: "JobsDetailPageContainer" })(

View File

@@ -7,7 +7,10 @@ import { createStructuredSelector } from "reselect";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
import { setBodyshop } from "../../redux/user/user.actions";
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
import {
selectBodyshop,
selectCurrentUser
} from "../../redux/user/user.selectors";
import ManagePage from "./manage.page";
const mapStateToProps = createStructuredSelector({
@@ -33,12 +36,10 @@ export default connect(
useEffect(() => {
if (data) setBodyshop(data.bodyshops[0]);
return () => {
//
};
return () => {};
}, [data, setBodyshop]);
//TODO Translate later.
if (!bodyshop) return <LoadingSpinner message="Loading bodyshop data." />;
if (!bodyshop)
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
return <ManagePage match={match} />;
});