Progress
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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('/')
|
||||
});
|
||||
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user