passing address to saveRequest

This commit is contained in:
muerwre 2018-08-31 10:08:59 +07:00
parent 47e4f4a97d
commit fc1bac528a
5 changed files with 12 additions and 3 deletions

View file

@ -13,6 +13,7 @@ export class SaveDialog extends React.Component {
sending: false, sending: false,
finished: false, finished: false,
success: false, success: false,
overwriting: false,
}; };
setTitle = ({ target: { value } }) => this.setState({ title: (value || '') }); 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 { route, stickers } = this.props.editor.dumpData();
const { title, address } = this.state; const { title, address } = this.state;
const { id, token } = this.props.user; const { id, token } = this.props.user;
const { path, host } = getUrlData();
postMap({ postMap({
id, id,
@ -32,7 +34,7 @@ export class SaveDialog extends React.Component {
route, route,
stickers, stickers,
title, title,
address, address: (toTranslit(address.trim()) || toTranslit(title.trim()) || toTranslit(path.trim())),
}).then(console.log).catch(console.warn); }).then(console.log).catch(console.warn);
}; };

View file

@ -14,6 +14,7 @@ export class Sticker {
this.isDragging = false; this.isDragging = false;
this.map = map; this.map = map;
this.sticker = sticker; this.sticker = sticker;
this.editable = true;
this.deleteSticker = deleteSticker; this.deleteSticker = deleteSticker;
this.lockMapClicks = lockMapClicks; this.lockMapClicks = lockMapClicks;
@ -129,4 +130,8 @@ export class Sticker {
latlng: this.latlng, latlng: this.latlng,
sticker: this.sticker, sticker: this.sticker,
}) })
stopEditing = () => ({
});
} }

View file

@ -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 })); }).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', action: 'store',
title, title,
address, address,

View file

@ -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) || ''));