This commit is contained in:
Riccardo
2021-08-29 10:39:39 +02:00
parent 2f119e43bd
commit 5368f40b04
8 changed files with 75 additions and 131 deletions

View File

@@ -21,10 +21,10 @@ const Appointment = (props) => {
onCompleted: () => history.push('/')
})
const updateAppointment = () => {
let path = `/update/${appointment._id}`;
history.push(path);
}
// const updateAppointment = () => {
// let path = `/update/${appointment._id}`;
// history.push(path);
// }
return (
<div>

View File

@@ -43,34 +43,34 @@ const CreateAppointment = () => {
start: formState.start,
end: formState.end
},
// update: (cache, { data: { createAppointment } }) => {
// const take = APPOINTMENTS_PER_PAGE;
// const skip = 0;
// const orderBy = { createdAt: 'desc' };
update: (cache, { data: { createAppointment } }) => {
const take = APPOINTMENTS_PER_PAGE;
const skip = 0;
const orderBy = { createdAt: 'desc' };
// const data = cache.readQuery({
// query: APPOINTMENTS_QUERY,
// variables: {
// take,
// skip,
// orderBy
// }
// });
const data = cache.readQuery({
query: APPOINTMENTS_QUERY,
variables: {
take,
skip,
orderBy
}
});
// cache.writeQuery({
// query: APPOINTMENTS_QUERY,
// data: {
// allAppointments: {
// appointments: [createAppointment, ...data.allAppointments]
// }
// },
// variables: {
// take,
// skip,
// orderBy
// }
// });
// },
cache.writeQuery({
query: APPOINTMENTS_QUERY,
data: {
allAppointments: {
appointments: [createAppointment, ...data.allAppointments]
}
},
variables: {
take,
skip,
orderBy
}
});
},
onCompleted: () => history.push('/')
});

View File

@@ -1,11 +1,11 @@
import React from 'react';
// import { useHistory } from 'react-router';
import { useHistory } from 'react-router';
import { Link } from 'react-router-dom';
// import { AUTH_TOKEN } from '../../constants';
import { AUTH_TOKEN } from '../../constants';
const Header = () => {
// const history = useHistory();
// const authToken = localStorage.getItem(AUTH_TOKEN);
const history = useHistory();
const authToken = localStorage.getItem(AUTH_TOKEN);
return (
<div className="flex pa1 justify-between nowrap orange">
<div className="flex flex-fixed black">
@@ -20,7 +20,7 @@ const Header = () => {
{/* <div className="flex flex-fixed">
<Link to="/search" className="ml1 no-underline black">Search</Link>
</div> */}
{/* <div className="flex flex-fixed">
<div className="flex flex-fixed">
{authToken ? (
<div className="ml1 pointer black"
onClick={() => {
@@ -31,7 +31,7 @@ const Header = () => {
) : (
<Link to="/login" className="ml1 no-underline black">Login</Link>
)}
</div> */}
</div>
</div>
);
};