Comments (3)
Hi. If you look at axios source code here and here. They are just simple wrappers over Promise :)
// Expose all/spread
axios.all = function all(promises) {
return Promise.all(promises);
};
// Axios.speard
module.exports = function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
I think that is because of an old legacy support problem. While nuxt supports modern ES6 out of the box so we can use simple approach:
// In asyncData or fetch
// Parallel requests
const [ acct, perms ] = await Promise.all([getUserAccount(), getUserPermissions()])
// Sequential requests
const acct = await getUserAccount()
const perms = await getUserPermissions()
from legacy-modules.
Thanks @pi0 - very helpful!
from legacy-modules.
Hi. If you look at axios source code here and here. They are just simple wrappers over Promise :)
// Expose all/spread axios.all = function all(promises) { return Promise.all(promises); }; // Axios.speard module.exports = function spread(callback) { return function wrap(arr) { return callback.apply(null, arr); };I think that is because of an old legacy support problem. While nuxt supports modern ES6 out of the box so we can use simple approach:
// In asyncData or fetch // Parallel requests const [ acct, perms ] = await Promise.all([getUserAccount(), getUserPermissions()]) // Sequential requests const acct = await getUserAccount() const perms = await getUserPermissions()
Hi @pi0 so in nuxt vuex store module how to use these function?
could you please give an example vuex store action?
thanks
from legacy-modules.
Related Issues (20)
- markdownit v1.2.8 typo: Object.asign is not a function HOT 1
- @nuxtjs/toast - How to pass options to globally configured toast module HOT 3
- Module in a separate chunk ? HOT 1
- Hot Reload doesn't work
- Nuxt Runtime Config
- RTL support
- Add ignoreRoutes option
- Is it dead? HOT 3
- Sorting by stars HOT 1
- Extract markdownit module HOT 3
- Extract yandex-metrika module HOT 3
- Extract component-cache module
- Extract bulma-module HOT 5
- @nuxtjs/browserconfig - Incorrect XML markup?
- Discussion about last modules HOT 3
- toast ssr problem HOT 3
- @nuxtjs/yandex-metrika | Counter not found, but data is being transferred
- @nuxtjs/toast => Cannot read property 'show' of undefined HOT 2
- Dependency Dashboard
- P
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from legacy-modules.