How to use axios
First, you need to add "axios" in config.capabilities of your template:
class Template implements OpenSubmitterTemplateProtocol {
config: TemplateConfig = {
// Based on this setting, OpenSubmitter will inject Axios object into this template
capabilities: ['axios'],
// other settings here
}
axios: typeof axios | null; // dummy property for your IDE
}
That's all, just use axios in getTask method in your template as you'd normally do in any other code:
async runTask(task: TemplateTask) {
let result = '';
try {
this.log('navigating...');
result = (await this.axios.get("http://bropanel.com/")).data;
} catch (e) {
this.log('err while loading the page: ' + e);
}
// Do something with "result"
}