Guest User

Untitled

a guest
Nov 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. export default class EditEvent extends React.Component{
  2.  
  3. EventUpdate(e){
  4. e.preventDefault();
  5. console.log('Data submited for updated');
  6.  
  7.  
  8. }
  9.  
  10. render(){
  11. console.log(this.props.match.params.id);
  12.  
  13. Meteor.subscribe('allowedData');
  14. let updateData = Events.findOne({_id:this.props.match.params.id});
  15. console.log('Update 1', updateData);
  16.  
  17. return(
  18. <div>
  19. <form className="upload-event-from" onSubmit={this.EventUpdate.bind(this)}>
  20. <div className="form-group">
  21. <input
  22. value=""
  23. type="text"
  24. className="form-control"
  25. id="event_title"
  26. placeholder="Event Title"
  27. name="title"
  28. />
  29. <span className="error-message">Error Message</span>
  30. </div>
  31.  
  32. <div className="form-group fg-icon">
  33. <label>Upload Video</label>
  34.  
  35. <input type="file" className="form-control-file form-control" id="exampleFormControlFile1" id="videoupload" />
  36.  
  37. <img src="/img/icons/video.png" alt="Video" />
  38. </div>
  39.  
  40. <div className="user-type">
  41. Event Status
  42.  
  43.  
  44. </div>
  45. <span id="message" ></span>
  46.  
  47. <center>
  48. <button type="submit" className="btn app-btn">Update</button>
  49. </center>
  50. </form>
  51. </div>
  52. );
  53. }
  54.  
  55. }
  56.  
  57. import { withTracker } from 'meteor/react-meteor-data';
  58.  
  59. class EditEvent extends React.Component{
  60. EventUpdate(e){
  61. e.preventDefault();
  62. console.log('Data submited for updated');
  63. }
  64.  
  65. render(){
  66. const {
  67. loading,
  68. updateData,
  69. } = this.props;
  70.  
  71. return loading ? null : (
  72. <div>
  73. { console.log('eventData', eventData) }
  74. <form className="upload-event-from" onSubmit={this.EventUpdate.bind(this)}>
  75. <div className="form-group">
  76. <input
  77. value=""
  78. type="text"
  79. className="form-control"
  80. id="event_title"
  81. placeholder="Event Title"
  82. name="title"
  83. />
  84. <span className="error-message">Error Message</span>
  85. </div>
  86.  
  87. <div className="form-group fg-icon">
  88. <label>Upload Video</label>
  89.  
  90. <input type="file" className="form-control-file form-control" id="exampleFormControlFile1" id="videoupload" />
  91.  
  92. <img src="/img/icons/video.png" alt="Video" />
  93. </div>
  94.  
  95. <div className="user-type">
  96. Event Status
  97.  
  98.  
  99. </div>
  100. <span id="message" ></span>
  101.  
  102. <center>
  103. <button type="submit" className="btn app-btn">Update</button>
  104. </center>
  105. </form>
  106. </div>
  107. );
  108. }
  109.  
  110. }
  111.  
  112. export default withTracker(() => {
  113. const subscription = Meteor.subscribe('allowedData');
  114.  
  115. return {
  116. loading: !subscription.ready(),
  117. updateData: Events.findOne({_id:this.props.match.params.id}),
  118. };
  119. })(EditEvent);
Add Comment
Please, Sign In to add comment