From 03fe02362dc5ed5775265449a5bbdb9bc778819d Mon Sep 17 00:00:00 2001 From: Volker Rose Date: Tue, 13 Oct 2020 16:53:15 +0200 Subject: [PATCH] fix(resourceModule): let state return a function This addresses the `'state' should be a method that returns an object` warning I encountered on a nuxt project. The Vuex documentation over at https://vuex.vuejs.org/guide/modules.html#module-local-state does also use a method for the `state` when building the local state of the example module. --- src/reststate-vuex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reststate-vuex.js b/src/reststate-vuex.js index 5dc3af7..a2e8772 100644 --- a/src/reststate-vuex.js +++ b/src/reststate-vuex.js @@ -119,7 +119,7 @@ const resourceModule = ({ name: resourceName, httpClient }) => { return { namespaced: true, - state: initialState(), + state: initialState, mutations: { REPLACE_ALL_RECORDS: (state, records) => {