@@ -61,25 +61,15 @@ class BaseService {
61
61
return this . submit < T > ( 'get' , id )
62
62
}
63
63
64
- post < T > ( payload : any ) : Promise < T >
65
- post < T > ( payload : any , config ?: AxiosRequestConfig ) : Promise < T >
66
64
post < T > ( payload : any , config ?: AxiosRequestConfig ) {
67
65
return this . submit < T > ( 'post' , '' , payload , config )
68
66
}
69
67
70
- store < T > ( payload : any ) : Promise < T >
71
- store < T > ( payload : any , config ?: AxiosRequestConfig ) : Promise < T >
72
68
store < T > ( payload : any , config ?: AxiosRequestConfig ) {
73
69
return this . post < T > ( payload , config )
74
70
}
75
71
76
- put < T > ( payload : any , config ?: AxiosRequestConfig ) : Promise < T >
77
- put < T > (
78
- id : string | number ,
79
- payload : any ,
80
- config ?: AxiosRequestConfig ,
81
- ) : Promise < T >
82
- put < T > ( id : string | number , payload ?: any , config ?: AxiosRequestConfig ) {
72
+ put < T > ( id : any , payload ?: any , config ?: AxiosRequestConfig ) {
83
73
const parameter = id && ! isObject ( id ) ? `/${ id } ` : ''
84
74
const body = isObject ( id ) ? id : payload
85
75
const requestType : Method = hasFiles ( body ) ? 'post' : 'put'
@@ -89,13 +79,7 @@ class BaseService {
89
79
return this . submit < T > ( requestType , parameter , body , config )
90
80
}
91
81
92
- patch < T > ( payload : any , config ?: AxiosRequestConfig ) : Promise < T >
93
- patch < T > (
94
- id : string | number ,
95
- payload : any ,
96
- config ?: AxiosRequestConfig ,
97
- ) : Promise < T >
98
- patch < T > ( id : string | number , payload ?: any , config ?: AxiosRequestConfig ) {
82
+ patch < T > ( id : any , payload ?: any , config ?: AxiosRequestConfig ) {
99
83
const parameter = id && ! isObject ( id ) ? `/${ id } ` : ''
100
84
const body = isObject ( id ) ? id : payload
101
85
return this . submit < T > ( 'patch' , parameter , body , config )
@@ -114,12 +98,12 @@ class BaseService {
114
98
}
115
99
116
100
submit < T = any > (
117
- requestType : Method ,
101
+ method : Method ,
118
102
parameter ?: string | number ,
119
103
form ?: T ,
120
104
config ?: AxiosRequestConfig ,
121
105
) : Promise < T > {
122
- const method = BaseService . __validateRequestType ( requestType )
106
+ BaseService . __validateRequestType ( method )
123
107
this . beforeSubmit ( )
124
108
return new Promise ( ( resolve , reject ) => {
125
109
const data = hasFiles ( form ) ? objectToFormData ( form ) : form
@@ -190,8 +174,6 @@ class BaseService {
190
174
return this
191
175
}
192
176
193
- setParameter ( parameter : string ) : this
194
- setParameter ( parameter : string , value ?: any ) : this
195
177
setParameter ( parameter : string , value ?: any ) : this {
196
178
if ( ! value ) {
197
179
const options : IParseOptions = Object . assign ( { } , this . $parsedQs , {
@@ -206,8 +188,6 @@ class BaseService {
206
188
return this
207
189
}
208
190
209
- removeParameters ( ) : this
210
- removeParameters ( parameters : any [ ] ) : this
211
191
removeParameters ( parameters = [ ] as any [ ] ) : this {
212
192
if ( ! parameters || ! parameters . length ) {
213
193
this . parameters = [ ]
0 commit comments