Cleanup database + updates to apollo error handler to check all errors + added hash history to jobs list.
This commit is contained in:
@@ -4,12 +4,14 @@ import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import { withRouter } from "react-router-dom";
|
||||
|
||||
export default function JobsList({
|
||||
export default withRouter(function JobsList({
|
||||
loading,
|
||||
jobs,
|
||||
selectedJob,
|
||||
setSelectedJob
|
||||
setSelectedJob,
|
||||
history
|
||||
}) {
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
@@ -182,6 +184,7 @@ export default function JobsList({
|
||||
if (record) {
|
||||
if (record.id) {
|
||||
setSelectedJob(record.id);
|
||||
history.push(`#${record.id}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -222,4 +225,4 @@ export default function JobsList({
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,10 +9,20 @@ const errorLink = onError(
|
||||
console.log("networkError", networkError);
|
||||
console.log("operation", operation);
|
||||
console.log("forward", forward);
|
||||
if (
|
||||
graphQLErrors[0]?.message.includes("JWTExpired") ||
|
||||
networkError?.message.includes("JWTExpired")
|
||||
) {
|
||||
|
||||
let expired = false;
|
||||
|
||||
if (graphQLErrors) {
|
||||
if (graphQLErrors[0].message.includes("JWTExpired")) {
|
||||
expired = true;
|
||||
}
|
||||
}
|
||||
if (networkError) {
|
||||
if (networkError?.message.includes("JWTExpired")) {
|
||||
expired = true;
|
||||
}
|
||||
}
|
||||
if (expired) {
|
||||
//User access token has expired
|
||||
//props.history.push("/network-error");
|
||||
console.log("We need a new token!");
|
||||
|
||||
@@ -8,7 +8,7 @@ import JobsList from "../../components/jobs-list/jobs-list.component";
|
||||
import JobDetailCards from "../../components/job-detail-cards/job-detail-cards.component";
|
||||
|
||||
//TODO: Implement pagination for this.
|
||||
export default function JobsPage() {
|
||||
export default function JobsPage({ match, location }) {
|
||||
const { loading, error, data } = useSubscription(SUBSCRIPTION_ALL_OPEN_JOBS, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
@@ -18,9 +18,11 @@ export default function JobsPage() {
|
||||
document.title = t("titles.jobs");
|
||||
}, [t]);
|
||||
|
||||
const [selectedJob, setSelectedJob] = useState(null);
|
||||
const { hash } = location;
|
||||
const [selectedJob, setSelectedJob] = useState(hash ? hash.substr(1) : null);
|
||||
console.log("Jobs Page Render.");
|
||||
|
||||
if (error) return <AlertComponent message={error.message} />;
|
||||
if (error) return <AlertComponent message={error.message} type='error' />;
|
||||
return (
|
||||
<Col span={22} offset={1}>
|
||||
<JobsList
|
||||
|
||||
Reference in New Issue
Block a user