mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
enabling / disabling editor from url
This commit is contained in:
parent
b35a063cd7
commit
e3e209ff65
5 changed files with 70 additions and 38 deletions
|
@ -4,25 +4,19 @@ import { API } from '$constants/api';
|
|||
|
||||
const report = console.warn;
|
||||
|
||||
export const checkUserToken = ({
|
||||
callback, fallback, id, token
|
||||
}) => (
|
||||
axios.get(API.CHECK_TOKEN, {
|
||||
params: { action: 'check_token', id, token }
|
||||
})
|
||||
.then(result => (result && result.data))
|
||||
.then(data => ({ ...data, id, token }))
|
||||
.then(callback)
|
||||
.catch(fallback)
|
||||
);
|
||||
export const getGuestToken = ({ callback }) => (
|
||||
axios.get(API.GET_GUEST, {
|
||||
params: { action: 'gen_guest_token' }
|
||||
})
|
||||
.then(result => (result && result.data))
|
||||
.then(callback)
|
||||
.catch(report)
|
||||
);
|
||||
export const checkUserToken = ({ id, token }) => axios.get(API.CHECK_TOKEN, {
|
||||
params: {
|
||||
id,
|
||||
token,
|
||||
action: 'check_token',
|
||||
}
|
||||
}).then(result => (result && result.data && { ...result.data, id, token }))
|
||||
|
||||
export const getGuestToken = () => axios.get(API.GET_GUEST, {
|
||||
params: {
|
||||
action: 'gen_guest_token'
|
||||
}
|
||||
}).then(result => (result && result.data));
|
||||
|
||||
export const getMergedImage = ({ placement, callback }) => (
|
||||
axios.get(API.COMPOSE, {
|
||||
|
@ -32,12 +26,9 @@ export const getMergedImage = ({ placement, 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)
|
||||
)
|
||||
export const getStoredMap = ({ name }) => axios.get(API.GET_MAP, {
|
||||
params: {
|
||||
name,
|
||||
action: 'load'
|
||||
}
|
||||
}).then(result => (result && result.data && result.data.data));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue