Hello everyone,
I've the following code:
render() {
return (
<
Scheduler
height={"100%"}
data={this.state.data}
onDataChange={this.handleDataChange}
transport={{
token: this.props.token
}}
modelFields={{
id: "TaskID",
title: "Title",
description: "Comment",
start: "Start",
end: "End",
recurrenceRule: "RecurrenceRule",
recurrenceId: "RecurrenceID",
recurrenceExceptions: "RecurrenceException",
token: this.props.token
}}
editItem={TaskItem}
form={TaskForm}
editable={{
add: true,
remove: true,
drag: true,
resize: true,
edit: true
}}
group={{
resources: ["Persons"],
orientation: "horizontal"
}}
resources={[{
name: "Persons",
data: [
{text: "Sascha", value: 35, color: "#5392E4"},
{text: "Alex", value: 39, color: "#5392E4"},
{text: "Leonhard", value: 54, color: "#5392E4"},
{text: "Daniel", value: 91, color: "#5392E4"}
],
field: "PersonIDs",
valueField: "value",
textField: "text",
colorField: "color"
}]}
>
<
DayView
title
=
"Day View"
workDayStart={"05:00"}
workDayEnd={"20:00"}
showWorkHours={true}
slotDuration={60}
slotDivisions={4}
/>
<
WorkWeekView
title
=
"Week View"
workWeekStart={Day.Monday}
workWeekEnd={Day.Friday}
workDayStart={"05:00"}
workDayEnd={"20:00"}
showWorkHours={true}
slotDuration={60}
slotDivisions={4}
/>
</
Scheduler
>
);
}
And I need to pass a Bearer token property to my form you can see on the code above called TaskForm. So that on the TaskForm with the following code I can get this token on the this.props a pass it to other components. I need this so on many of the child components in this form I can make api calls with axios.
class TaskForm extends Component {
constructor(props) {
super(props);
}
/*const requiredValidator = React.useCallback(
(value) => (value === undefined || value === null || value === ''
? 'Field is required.'
: undefined),
[]
);
const formValidator = (_dataItem, formValueGetter) => {
let result = {};
result.Patient = [
requiredValidator(formValueGetter('Patient'))
].filter(Boolean).reduce((current, acc) => current || acc, '');
result.Treatment = [
requiredValidator(formValueGetter('Treatment'))
].filter(Boolean).reduce((current, acc) => current || acc, '');
return result;
};*/
componentDidMount() {
console.log(this.props);
}
render() {
return (
<
SchedulerForm
{...this.props}
editor={TaskFormEditor}
dialog={TaskDialog}
/*validator={formValidator}*/
/>
);
}
}
export default TaskForm;