B
B
BonBon Slick2020-02-09 07:33:29
Vue.js
BonBon Slick, 2020-02-09 07:33:29

Nuxt Uncaught (in promise) TypeError: commit is not a function?

Action example

async [FORM_ACTION_SUBMIT_FORM] ({commit, state}, {fetchBody}) {
        if (true === state.isSending) {
            return new Promise(async (resolve, reject) => {
                reject(new Error('Already sending...'));
            });
        }


an example of calling an action, right, it does not exist, the action is not called anywhere at all.

Mistakes
_callee3$	@	actions.js?4805:39
tryCatch	@	runtime.js?96cf:45
invoke	@	runtime.js?96cf:271
prototype.<computed>	@	runtime.js?96cf:97
asyncGeneratorStep	@	asyncToGenerator.js?1da1:3
_next	@	asyncToGenerator.js?1da1:25
eval	@	asyncToGenerator.js?1da1:32
eval	@	asyncToGenerator.js?1da1:21
eval	@	actions.js?4805:39
wrappedGetter	@	vuex.esm.js?2f62:777
eval	@	vuex.esm.js?2f62:95
get	@	vue.runtime.esm.js?2b0e:4479
evaluate	@	vue.runtime.esm.js?2b0e:4584
computedGetter	@	vue.runtime.esm.js?2b0e:4836
get	@	vuex.esm.js?2f62:567
get	@	backend.js:1444
stringify	@	backend.js:3147
stringify	@	backend.js:270
stringifyStore	@	backend.js:1191
reset	@	backend.js:1058
VuexBackend	@	backend.js:893
initVuexBackend	@	backend.js:1430
(anonymous)	@	backend.js:2208
Promise.then (async)		
connect	@	backend.js:2131
initBackend	@	backend.js:2119
handshake	@	backend.js:4322
postMessage (async)		
o	@	proxy.js:1
262	@	proxy.js:1
n	@	proxy.js:1
(anonymous)	@	proxy.js:1
(anonymous)	@	proxy.js:1

actions.js?4805:47 Uncaught (in promise) TypeError: commit is not a function
    at _callee2$ (actions.js?4805:47)
    at tryCatch (runtime.js?96cf:45)
    at Generator.invoke [as _invoke] (runtime.js?96cf:271)
    at Generator.prototype.<computed> [as next] (runtime.js?96cf:97)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
    at _next (asyncToGenerator.js?1da1:25)
    at eval (asyncToGenerator.js?1da1:32)
    at new Promise (<anonymous>)
    at eval (asyncToGenerator.js?1da1:21)
    at eval (actions.js?4805:39)


If the action is ASYNC and blocks the UI, then the SPA assembly works, except for the UI, which must wait for the method to execute. That is, all methods from the Store that are ASYNC will not work in NUXT, because of the magic that it does.

What is a "feature" and how to remove it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question