Fix rendering of events in Availability & refactor

- Possible dates were not ordered by dates, which in turn crashed
the rendering of Availability component
- Token was not added to headers after login
- Refactor Schedule by removing useless UseEffect
- Simplify rendering of events in Selected Dates (for now)
This commit is contained in:
2020-09-02 23:08:41 +02:00
parent 8dbe2185de
commit 6cc19211c1
8 changed files with 35 additions and 46 deletions

View File

@@ -28,10 +28,7 @@ export default function IntervalSelector({
.toFormat('yyyy-MM-dd');
// Create an event dates list used to create the days columns
const daysList = [];
selectedDates.forEach((event) => {
daysList.push(event.start);
});
const daysList = selectedDates.map((event) => event.start);
const handleDayDidMount = (info) => {
let currentDate = DateTime.fromJSDate(info.date).toFormat('yyyy-MM-dd');

View File

@@ -1,13 +1,12 @@
import React from 'react';
import { Divider, Icon, IconButton } from 'rsuite';
export default function SelectedDates({ datesList, handleDelete }) {
export default function SelectedDates({ possibleDates, handleDelete }) {
return (
<ul>
{datesList.map((date) => (
<li key={date}>
{date.setLocale('en-gb').toLocaleString()}
{` (${date.weekdayShort})`}
{possibleDates.map((date) => (
<li key={date.start}>
{date.start}
<Divider vertical />
<IconButton
icon={<Icon icon='close' />}