HTTP - Axios integrated
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import Backbone from 'backbone';
|
||||
import * as _ from 'underscore';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import Mustache from 'mustache';
|
||||
import axios from 'axios';
|
||||
import Http from './http';
|
||||
|
||||
|
||||
export default class MyView extends Backbone.View {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
@@ -13,11 +16,18 @@ export default class MyView extends Backbone.View {
|
||||
this.el = '#myarea';
|
||||
this.$el = $(this.el);
|
||||
this.template = 'Hello';
|
||||
Http.service.get('olapa')
|
||||
.then(function (response) {
|
||||
console.log(response);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
this.render();
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
console.log(this.el)
|
||||
this.$el.html(Mustache.render(this.template));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user