spatie / vue-table-component

A straight to the point Vue component to display tables
http://vue-table-component.spatie.be
MIT License
588 stars 149 forks source link

Does this require async/await usage #95

Closed makapaka23 closed 6 years ago

makapaka23 commented 6 years ago

I cannot seem to get this to work with normal promises instead of async await (for now trying not to use babel etc).

I'm getting the error

Uncaught (in promise) TypeError: Cannot read property 'pagination' of undefined

Standard way I've been doing things in the method using <table-component :data="fetchSessions">

fetchSessions() { axios.get(this.endpoint) .then(({data}) => { this.dataSession = data; }); }, Anything you can suggest to get it working with promises or must it use async await?

ankurk91 commented 6 years ago

It should work without async await.

Can you try this -

return new Promise(function(resolve, reject) {   
    axios.get('url/to/api').then(response=>{
        resolve(response.data);
    }).catch (error=>{
        reject(error);
    });    
});

FYI: If you use babel, it will also convert it to promise.

freekmurze commented 6 years ago

Seems like this issue is not related to this package.