Skip to content

Instantly share code, notes, and snippets.

@Kamill90
Created October 11, 2017 08:35
Show Gist options
  • Save Kamill90/f8642cba5e5889f4ef7f489598c193ea to your computer and use it in GitHub Desktop.
Save Kamill90/f8642cba5e5889f4ef7f489598c193ea to your computer and use it in GitHub Desktop.
// ... dependecies
//query
const fetchDoctor = require('./fetchDoctor');
const fetchVisits = require('./fetchVisits');
class DoctorPage extends Component {
constructor(props){
super(props);
let daylist = {};
var today = new Date();
var year = today.getFullYear(); var month = today.getMonth(); var date = today.getDate();
for(var i=0; i<30; i++){
let defaultDate = new Date(year, month, date + i);
let dateKey = `${defaultDate.getDate()}.${defaultDate.getMonth()}.${defaultDate.getFullYear()}`;
daylist[dateKey] = {
"fullDateString":defaultDate,
};
}
this.state={
DayList: daylist
};
};
render(){
if(this.props.data.loading){
return(
<div>
loading
</div>
)
}
else {
console.log(this.state);
let DoctorData = this.props.data.doctorByAdmin;
return(
<div>
{/* //add accessibility */}
<ul>
{this.ListOFCombinedDaysAndData()}
</ul>
</div>
)}
}
};
export default compose(
graphql(query,{
name:"fetchVisits",
options:(props) => {
return {variables: {
Visit: props.params.Visitid
}}
}
}),
graphql(fetchDoctors,{
name: "fetchDoctors",
options:(props) => {
return {variables: {
DoctorId: props.params.id
}}
}
})
)(DoctorPage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment