diff --git a/src/components/save/SaveDialog.jsx b/src/components/save/SaveDialog.jsx index 5554b75..96a1966 100644 --- a/src/components/save/SaveDialog.jsx +++ b/src/components/save/SaveDialog.jsx @@ -13,6 +13,7 @@ export class SaveDialog extends React.Component { sending: false, finished: false, success: false, + overwriting: false, }; setTitle = ({ target: { value } }) => this.setState({ title: (value || '') }); @@ -25,6 +26,7 @@ export class SaveDialog extends React.Component { const { route, stickers } = this.props.editor.dumpData(); const { title, address } = this.state; const { id, token } = this.props.user; + const { path, host } = getUrlData(); postMap({ id, @@ -32,7 +34,7 @@ export class SaveDialog extends React.Component { route, stickers, title, - address, + address: (toTranslit(address.trim()) || toTranslit(title.trim()) || toTranslit(path.trim())), }).then(console.log).catch(console.warn); }; diff --git a/src/constants/tips.jsx b/src/constants/tips.js similarity index 100% rename from src/constants/tips.jsx rename to src/constants/tips.js diff --git a/src/modules/Sticker.js b/src/modules/Sticker.js index 225b6de..c0820cb 100644 --- a/src/modules/Sticker.js +++ b/src/modules/Sticker.js @@ -14,6 +14,7 @@ export class Sticker { this.isDragging = false; this.map = map; this.sticker = sticker; + this.editable = true; this.deleteSticker = deleteSticker; this.lockMapClicks = lockMapClicks; @@ -129,4 +130,8 @@ export class Sticker { latlng: this.latlng, sticker: this.sticker, }) + + stopEditing = () => ({ + + }); } diff --git a/src/utils/api.js b/src/utils/api.js index ecfe9c2..1fd88a6 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -33,7 +33,9 @@ export const getStoredMap = ({ name }) => axios.get(API.GET_MAP, { } }).then(result => (result && result.data && result.data.data && result.data.owner && { ...result.data.data, owner: result.data.owner })); -export const postMap = ({ title, address, route, stickers, id, token }) => axios.post(API.POST_MAP, { +export const postMap = ({ + title, address, route, stickers, id, token +}) => axios.post(API.POST_MAP, { action: 'store', title, address, diff --git a/src/utils/format.js b/src/utils/format.js index 8b2162a..8789d43 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -9,4 +9,4 @@ export const toHours = (info) => { }; -export const toTranslit = string => ru.reduce((text, el, i) => (text.replace(new RegExp(ru[i], 'g'), en[i])), string); +export const toTranslit = string => ru.reduce((text, el, i) => (text.replace(new RegExp(ru[i], 'g'), en[i])), (String(string) || ''));