Skip to content

Commit 100d4ca

Browse files
committed
Change undefined vuex state properties for null
1 parent f873413 commit 100d4ca

File tree

4 files changed

+33
-32
lines changed

4 files changed

+33
-32
lines changed

src/auth-module/mutations.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ export default function makeAuthMutations (feathers) {
2727
state.errorOnAuthenticate = Object.assign({}, error)
2828
},
2929
clearAuthenticateError (state) {
30-
state.errorOnAuthenticate = undefined
30+
state.errorOnAuthenticate = null
3131
},
3232
setLogoutError (state, error) {
3333
state.errorOnLogout = Object.assign({}, error)
3434
},
3535
clearLogoutError (state) {
36-
state.errorOnLogout = undefined
36+
state.errorOnLogout = null
3737
},
3838

3939
logout (state) {
40-
state.payload = undefined
41-
state.accessToken = undefined
40+
state.payload = null
41+
state.accessToken = null
4242
if (state.user) {
43-
state.user = undefined
43+
state.user = null
4444
}
4545
}
4646
}

src/auth-module/state.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
export default function setupAuthState ({ userService }) {
22
const state = {
3-
accessToken: undefined, // The JWT
4-
payload: undefined, // The JWT payload
3+
accessToken: null, // The JWT
4+
payload: null, // The JWT payload
55

66
isAuthenticatePending: false,
77
isLogoutPending: false,
88

9-
errorOnAuthenticate: undefined,
10-
errorOnLogout: undefined
9+
errorOnAuthenticate: null,
10+
errorOnLogout: null,
11+
user: null
1112
}
1213
// If a userService string was passed, add a user attribute
1314
if (userService) {
14-
Object.assign(state, { userService, user: undefined })
15+
Object.assign(state, { userService })
1516
}
1617
return state
1718
}

src/service-module/mutations.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export default function makeServiceMutations (servicePath) {
6060
state.keyedById = keyedById
6161

6262
if (currentId === idToBeRemoved) {
63-
state.currentId = undefined
64-
state.copy = undefined
63+
state.currentId = null
64+
state.copy = null
6565
}
6666
},
6767

@@ -100,15 +100,15 @@ export default function makeServiceMutations (servicePath) {
100100
state.keyedById = keyedById
101101

102102
if (currentId && mapOfIdsToRemove[currentId]) {
103-
state.currentId = undefined
104-
state.copy = undefined
103+
state.currentId = null
104+
state.copy = null
105105
}
106106
},
107107

108108
clearAll (state) {
109109
state.ids = []
110-
state.currentId = undefined
111-
state.copy = undefined
110+
state.currentId = null
111+
state.copy = null
112112
state.keyedById = {}
113113
},
114114

@@ -143,8 +143,8 @@ export default function makeServiceMutations (servicePath) {
143143
},
144144

145145
clearCurrent (state) {
146-
state.currentId = undefined
147-
state.copy = undefined
146+
state.currentId = null
147+
state.copy = null
148148
},
149149

150150
// Deep assigns current to copy
@@ -211,37 +211,37 @@ export default function makeServiceMutations (servicePath) {
211211
state.errorOnFind = Object.assign({}, serializeError(payload))
212212
},
213213
clearFindError (state) {
214-
state.errorOnFind = undefined
214+
state.errorOnFind = null
215215
},
216216
setGetError (state, payload) {
217217
state.errorOnGet = Object.assign({}, serializeError(payload))
218218
},
219219
clearGetError (state) {
220-
state.errorOnGet = undefined
220+
state.errorOnGet = null
221221
},
222222
setCreateError (state, payload) {
223223
state.errorOnCreate = Object.assign({}, serializeError(payload))
224224
},
225225
clearCreateError (state) {
226-
state.errorOnCreate = undefined
226+
state.errorOnCreate = null
227227
},
228228
setUpdateError (state, payload) {
229229
state.errorOnUpdate = Object.assign({}, serializeError(payload))
230230
},
231231
clearUpdateError (state) {
232-
state.errorOnUpdate = undefined
232+
state.errorOnUpdate = null
233233
},
234234
setPatchError (state, payload) {
235235
state.errorOnPatch = Object.assign({}, serializeError(payload))
236236
},
237237
clearPatchError (state) {
238-
state.errorOnPatch = undefined
238+
state.errorOnPatch = null
239239
},
240240
setRemoveError (state, payload) {
241241
state.errorOnRemove = Object.assign({}, serializeError(payload))
242242
},
243243
clearRemoveError (state) {
244-
state.errorOnRemove = undefined
244+
state.errorOnRemove = null
245245
}
246246
}
247247
}

src/service-module/state.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ export default function makeDefaultState (servicePath, { idField, autoRemove, pa
22
const state = {
33
ids: [],
44
keyedById: {},
5-
currentId: undefined,
6-
copy: undefined,
5+
currentId: null,
6+
copy: null,
77
idField,
88
servicePath,
99
autoRemove,
@@ -16,12 +16,12 @@ export default function makeDefaultState (servicePath, { idField, autoRemove, pa
1616
isPatchPending: false,
1717
isRemovePending: false,
1818

19-
errorOnFind: undefined,
20-
errorOnGet: undefined,
21-
errorOnCreate: undefined,
22-
errorOnUpdate: undefined,
23-
errorOnPatch: undefined,
24-
errorOnRemove: undefined
19+
errorOnFind: null,
20+
errorOnGet: null,
21+
errorOnCreate: null,
22+
errorOnUpdate: null,
23+
errorOnPatch: null,
24+
errorOnRemove: null
2525
}
2626
return state
2727
}

0 commit comments

Comments
 (0)