File tree 3 files changed +384
-321
lines changed
3 files changed +384
-321
lines changed Original file line number Diff line number Diff line change 44
44
"@vuex-orm/core" : " >=0.34.0"
45
45
},
46
46
"dependencies" : {
47
- "axios" : " ^0.19.0"
47
+ "axios" : " ^0.19.0" ,
48
+ "lodash.isnil" : " latest" ,
49
+ "lodash.merge" : " latest" ,
50
+ "lodash.omitby" : " latest"
48
51
},
49
52
"devDependencies" : {
50
53
"@types/jest" : " ^24.0.23" ,
54
+ "@types/lodash.isnil" : " ^4.0.6" ,
55
+ "@types/lodash.merge" : " ^4.6.6" ,
56
+ "@types/lodash.omitby" : " ^4.6.6" ,
51
57
"@vuex-orm/core" : " ^0.34.1" ,
52
58
"axios-mock-adapter" : " ^1.17.0" ,
53
59
"codecov" : " ^3.5.0" ,
Original file line number Diff line number Diff line change 1
1
import { AxiosInstance , AxiosResponse } from 'axios'
2
2
import { Model } from '@vuex-orm/core'
3
+ import _merge from 'lodash.merge'
4
+ import _omitBy from 'lodash.omitby'
5
+ import _isNil from 'lodash.isnil'
3
6
import Config from '../contracts/Config'
4
7
import Response from './Response'
5
8
@@ -124,15 +127,16 @@ export default class Request {
124
127
125
128
/**
126
129
* Create a new config by merging the global config, the model config,
127
- * and the given config.
130
+ * and the given config. Any value that is null after the merge will
131
+ * have the entire entry removed.
128
132
*/
129
133
private createConfig ( config : Config ) : Config {
130
- return {
131
- ... this . config ,
132
- ... this . model . globalApiConfig ,
133
- ... this . model . apiConfig ,
134
- ... config
135
- }
134
+ return _omitBy ( _merge ( { } ,
135
+ this . config ,
136
+ this . model . globalApiConfig ,
137
+ this . model . apiConfig ,
138
+ config
139
+ ) , _isNil )
136
140
}
137
141
138
142
/**
You can’t perform that action at this time.
0 commit comments