Update LiveEditor

pull/880/head
Tuğçe Küçükoğlu 2021-01-21 16:53:02 +03:00
parent 478ef5b991
commit b6cb589f81
2 changed files with 25 additions and 11 deletions

View File

@ -511,23 +511,33 @@ img.flag {
`, `,
} }
if (this.service && this.data) { if (this.service) {
const dataArr = this.data.split(','); const dataArr = this.data ? this.data.split(',') : null;
dataArr.forEach(el => { if(dataArr) {
_files[`public/data/${el}.json`] = { dataArr.forEach(el => {
content: data[el] _files[`public/data/${el}.json`] = {
}; content: data[el]
};
_files[`src/service/${this.service}.js`] = { _files[`src/service/${this.service}.js`] = {
// content: services[this.service] content: `import axios from 'axios';
content: `import axios from 'axios';
import data from '../../public/data/${el}.json'; import data from '../../public/data/${el}.json';
${services[this.service]} ${services[this.service]}
` `
}; };
}); });
}
else {
_files[`src/service/${this.service}.js`] = {
content: `import axios from 'axios';
${services[this.service]}
`
};
}
extDependencies['axios'] = "^0.19.0"; extDependencies['axios'] = "^0.19.0";

View File

@ -25,6 +25,10 @@ export default class CustomerService {
getCustomersXLarge() { getCustomersXLarge() {
return axios.get(data).then(res => res.config.url.data); return axios.get(data).then(res => res.config.url.data);
} }
getCustomers(params) {
return axios.get('https://www.primefaces.org/data/customers', { params }).then(res => res.data)
}
} }
`, `,
'EventService': ` 'EventService': `