spee.ch/react/api/assetApi.js

35 lines
908 B
JavaScript
Raw Normal View History

2018-02-07 22:26:07 +01:00
import Request from 'utils/request';
2018-03-16 00:31:01 +01:00
export function getLongClaimId (host, name, modifier) {
2018-02-07 22:26:07 +01:00
let body = {};
// create request params
if (modifier) {
if (modifier.id) {
body['claimId'] = modifier.id;
} else {
body['channelName'] = modifier.channel.name;
body['channelClaimId'] = modifier.channel.id;
}
}
body['claimName'] = name;
const params = {
method : 'POST',
headers: { 'Content-Type': 'application/json' },
body : JSON.stringify(body),
};
2018-02-13 03:50:19 +01:00
// create url
2018-03-16 00:31:01 +01:00
const url = `${host}/api/claim/long-id`;
2018-02-07 22:26:07 +01:00
// return the request promise
return Request(url, params);
};
2018-03-16 00:31:01 +01:00
export function getShortId (host, name, claimId) {
const url = `${host}/api/claim/short-id/${claimId}/${name}`;
return Request(url);
};
2018-03-16 00:31:01 +01:00
export function getClaimData (host, name, claimId) {
const url = `${host}/api/claim/data/${name}/${claimId}`;
return Request(url);
};