Appointment with Mongo

This commit is contained in:
Riccardo
2021-01-02 18:37:03 +01:00
parent 30407cac0a
commit c752e3ec80
12 changed files with 330 additions and 112 deletions

View File

@@ -3,7 +3,7 @@
import React, { Component } from 'react';
import AppointmentList from './AppointmentList';
import CreateLink from './CreateAppointment'
import CreateAppointment from './CreateAppointment'
import Header from './Header';
import Login from './Login'
import Search from './Search';
@@ -19,7 +19,7 @@ const App = () => {
<Route
exact
path="/create"
component={CreateLink}
component={CreateAppointment}
/>
<Route exact path="/login" component={Login} />
<Route exact path="/search" component={Search} />
@@ -34,31 +34,4 @@ const App = () => {
);
};
// class App extends Component {
// render() {
// return <CreateLink />;
// }
// }
// function App() {
// return (
// <div className="App">
// <header className="App-header">
// <img src={logo} className="App-logo" alt="logo" />
// <p>
// Edit <code>src/App.js</code> and save to reload.
// </p>
// <a
// className="App-link"
// href="https://reactjs.org"
// target="_blank"
// rel="noopener noreferrer"
// >
// Learn React
// </a>
// </header>
// </div>
// );
// }
export default App;

View File

@@ -61,7 +61,7 @@ const getQueryVariables = (isNewPage, page) => {
const skip = isNewPage ? (page - 1) * APPOINTMENTS_PER_PAGE : 0;
const take = isNewPage ? APPOINTMENTS_PER_PAGE : 100;
const orderBy = { createdAt: 'desc' };
console.log(isNewPage, page, APPOINTMENTS_PER_PAGE, skip, take, orderBy);
return { take, skip, orderBy };
};
@@ -78,8 +78,6 @@ const AppointmentList = () => {
pageIndexParams[pageIndexParams.length - 1]
);
console.log(pageIndexParams.length, page);
const pageIndex = page ? (page - 1) * APPOINTMENTS_PER_PAGE : 0;
const {

View File

@@ -6,14 +6,14 @@ import { FEED_QUERY } from './AppointmentList';
const CREATE_APPOINTMENT_MUTATION = gql`
mutation CreateAppointmentMutation(
$title: String!
$description: String!
$url: String!
) {
createAppointment(description: $description, url: $url) {
createAppointment(title: $title, description: $description) {
id
createdAt
url
title
description
createdAt
}
}
`;