From be509c3fd9f9d9efd3957ea24d7d1f4f422d87fa Mon Sep 17 00:00:00 2001 From: Dmitry A Date: Mon, 14 Oct 2019 22:05:39 +0300 Subject: [PATCH] clone tour --- TourCalcWebApp/App/containers/appstate.jsx | 19 +++++++++++++++- TourCalcWebApp/App/containers/tour-list.jsx | 24 +++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/TourCalcWebApp/App/containers/appstate.jsx b/TourCalcWebApp/App/containers/appstate.jsx index 7fbd2047..352bfebd 100644 --- a/TourCalcWebApp/App/containers/appstate.jsx +++ b/TourCalcWebApp/App/containers/appstate.jsx @@ -214,7 +214,24 @@ export default class AppState { }) .then(res => res.text()) .then((res) => res, (error) => { alert('Error add tour') }) - } + } + static addTourJson(comp, tour, accessCode, tname) { + if (tname != null) { + tour.name = tname + } + let b = JSON.stringify(tour, null, 2) + //alert('b: ' + b) + return fetch('/api/tour/add/' + accessCode, { + method: 'post', + headers: new Headers({ + "Authorization": 'Bearer ' + this.token, + "Content-Type": "application/json" + }), + body: b + }) + .then(res => res.text()) + .then((res) => res, (error) => { alert('Error add tour') }) + } static changeTourName(comp, tourid, tname) { let b = JSON.stringify({ name: tname }, null, 2) //alert('b: ' + b) diff --git a/TourCalcWebApp/App/containers/tour-list.jsx b/TourCalcWebApp/App/containers/tour-list.jsx index de341b68..0ee8717a 100644 --- a/TourCalcWebApp/App/containers/tour-list.jsx +++ b/TourCalcWebApp/App/containers/tour-list.jsx @@ -52,6 +52,8 @@ export default class TourList extends React.Component { : ) } + # + @@ -77,6 +79,28 @@ export default class TourList extends React.Component { + + + + {this.props.authData.type === 'Master' ? + Access code: + : + } +  New tour name: + ) })