first import attempts

This commit is contained in:
muerwre 2018-08-29 12:05:09 +07:00
parent 8da254ff9b
commit f7e8da1f1f
9 changed files with 57 additions and 6 deletions

View file

@ -7,7 +7,7 @@ const report = console.warn;
export const checkUserToken = ({
callback, fallback, id, token
}) => (
axios.get(API.GET_GUEST, {
axios.get(API.CHECK_TOKEN, {
params: { action: 'check_token', id, token }
})
.then(result => (result && result.data))
@ -31,3 +31,13 @@ export const getMergedImage = ({ placement, callback }) => (
.then(callback)
.catch(report)
);
export const getStoredMap = ({ name, callback }) => (
axios.get(API.GET_MAP, {
params: { name, action: 'load' }
})
.then(result => (result && result.data &&result.data.data))
.then(data => ({ ...data }))
.then(callback)
.catch(report)
)

2
src/utils/history.js Normal file
View file

@ -0,0 +1,2 @@
export const getPath = () => (window.location && window.location.pathname &&
window.location.pathname.replace(/^\//, ''));

7
src/utils/import.js Normal file
View file

@ -0,0 +1,7 @@
/*
functions to parse old maps data
*/
export const parseStickerAngle = ({ angle, format }) => parseFloat((format === 'old' ? angle - 3.14 : angle));
export const parseStickerStyle = ({ style, format }) => (format === 'old' ? 'green' : style);