2018-02-07 22:26:07 +01:00
|
|
|
import Request from 'utils/request';
|
|
|
|
|
|
|
|
export function getLongClaimId (name, modifier) {
|
2018-02-14 00:53:27 +01:00
|
|
|
// console.log('getting long claim id for asset:', 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: new Headers({
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
}),
|
|
|
|
body: JSON.stringify(body),
|
|
|
|
}
|
2018-02-13 03:50:19 +01:00
|
|
|
// create url
|
2018-02-07 22:26:07 +01:00
|
|
|
const url = `/api/claim/long-id`;
|
|
|
|
// return the request promise
|
|
|
|
return Request(url, params);
|
2018-02-08 03:01:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export function getShortId (name, claimId) {
|
2018-02-14 00:53:27 +01:00
|
|
|
// console.log('getting short id for asset:', name, claimId);
|
2018-02-08 03:01:51 +01:00
|
|
|
const url = `/api/claim/short-id/${claimId}/${name}`;
|
|
|
|
return Request(url);
|
|
|
|
};
|
|
|
|
|
|
|
|
export function getClaimData (name, claimId) {
|
2018-02-14 00:53:27 +01:00
|
|
|
// console.log('getting claim data for asset:', name, claimId);
|
2018-02-08 03:01:51 +01:00
|
|
|
const url = `/api/claim/data/${name}/${claimId}`;
|
|
|
|
return Request(url);
|
|
|
|
};
|