mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
passing address to saveRequest
This commit is contained in:
parent
47e4f4a97d
commit
fc1bac528a
5 changed files with 12 additions and 3 deletions
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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 = () => ({
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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) || ''));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue