Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (let key in params) {
if (params[key] === undefined) {
continue;
}
if (key === 'files') {
params[key].map(v =>
(v instanceof File) ? formData.append('files', v) : formData.append('files', v.originFileObj));
} else {
formData.append(key, params[key]);
}
}
// ็ผ่ฏ
// const { data } = await xhr.post(`${API_URL}/api/solidity/contract/compile`, formData)
const { data } = await xhr.post(`${CONTRACT_NODE_API}/api/solidity/contract/compile`, formData)
.catch(e => {
const errorData = [{
type: 'error',
content: `Compiled error: ${e.toString()}`
}];
error = errorData.concat(CompileStatus);
});
// ้่ฏฏ
if (!data){
this.setState({
CompileStatus: error,
compileLoading: false
});
return;
}
saveElement(elementId, value, valueId = null) {
if( this.state.submissionId === null ) {
console.error( 'Missing submission id for saving value.' );
return;
}
const submissionValuePostUrl = this.getEndpointUrl( '/submission_values' );
if( valueId === null ) {
axios.post(submissionValuePostUrl, {
form_id: this.formId,
submission_id: this.state.submissionId,
element_id: elementId,
value: value
})
.then(response => {
this.updateElement( elementId, value, response.data.id );
})
.catch( error => {
console.log( error );
});
} else {
console.log( 'There was a submission on this field!' );
}
}
export async function logout () {
const response = await axios.post(store.state.apiRoot + '/odaapi/auth/logout/')
return response.data
}
removeFile(title, callback) {
if (!this.validateSyncInfo(this.syncInfo)) return;
const that = this;
let params = new FormData();
axios.post(this.removeIPFSLink(that.syncInfo.hash, that.syncInfo.path + '/' + title + '/data/json.js'), params, {
headers: {
'content-type': 'multipart/form-data'
}
}).then((result) => {
that.$store.dispatch('setHash', result.data.response.Hash);
VueEventListener.fire('toggleLoading');
if (typeof callback !== 'undefined') callback();
}).catch((error) => {
VueEventListener.fire('error', error);
VueEventListener.fire('toggleLoading');
if (typeof callback !== 'undefined') callback(error);
});
},
removeIPFSLink(hash, path) {
export async function createStructure (name) {
try {
const response = await axios.post(`/odaapi/api/cstructs/`, {
short_name: store.state.shortName,
revision: store.state.revision,
is_packed: true,
name: name
})
return response.data
} catch (e) {
error({e, message: 'creating a structure definition'})
}
}
return dispatch => {
return axios.post(routeApi + '/upload', data, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
}
}
export async function createDefinedData (addr, typeKind, typeName, varName) {
try {
const response = await axios.post('/odaapi/api/definedData/', {
short_name: store.state.shortName,
revision: store.state.revision,
vma: addr,
type_kind: typeKind,
type_name: typeName,
var_name: varName
})
return response.data
} catch (e) {
error({e, message: e.response.data.detail})
}
}
getMarketInfoToken10 = async() => {
const { issuedAsset } = this.props;
const { id } = issuedAsset || {};
if (!!id) {
const param = {
tokenIdOrAddr: id
};
let { data: { data = {} } } = await xhr.post(`${MARKET_API_URL}/api/token/getTokenInfoByTokenIdOrAddr`, param);
const { tokenOtherInfo, description, sprice, fprice } = data;
const tokenOtherInfoObj = !!tokenOtherInfo ? JSON.parse(tokenOtherInfo) : {};
data.description = window.decodeURIComponent(description);
data = Object.assign(data, tokenOtherInfoObj, { sprice: `${sprice}`, fprice: `${fprice}` });
this.setState({
marketInfoToken10: data,
});
}
}
return dispatch => {
return axios.post(API_URL, {
operation: 'userResetPasswordVerifyCode',
params: data
})
}
}
createToken = async(infoData, tokenId) => {
const { data: { msg, data = {} } } = await xhr.post(`${MARKET_API_URL}/api/token/addBasicInfo`, infoData);
const { id } = data;
this.setState({
id,
msg,
},() => {
Lockr.rm('TokenLogo');
this.props.nextState({
msg,
id,
tokenId,
});
this.props.nextStep(2);
});
};