@@ -61,25 +61,15 @@ class BaseService {
6161 return this . submit < T > ( 'get' , id )
6262 }
6363
64- post < T > ( payload : any ) : Promise < T >
65- post < T > ( payload : any , config ?: AxiosRequestConfig ) : Promise < T >
6664 post < T > ( payload : any , config ?: AxiosRequestConfig ) {
6765 return this . submit < T > ( 'post' , '' , payload , config )
6866 }
6967
70- store < T > ( payload : any ) : Promise < T >
71- store < T > ( payload : any , config ?: AxiosRequestConfig ) : Promise < T >
7268 store < T > ( payload : any , config ?: AxiosRequestConfig ) {
7369 return this . post < T > ( payload , config )
7470 }
7571
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 ) {
8373 const parameter = id && ! isObject ( id ) ? `/${ id } ` : ''
8474 const body = isObject ( id ) ? id : payload
8575 const requestType : Method = hasFiles ( body ) ? 'post' : 'put'
@@ -89,13 +79,7 @@ class BaseService {
8979 return this . submit < T > ( requestType , parameter , body , config )
9080 }
9181
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 ) {
9983 const parameter = id && ! isObject ( id ) ? `/${ id } ` : ''
10084 const body = isObject ( id ) ? id : payload
10185 return this . submit < T > ( 'patch' , parameter , body , config )
@@ -114,12 +98,12 @@ class BaseService {
11498 }
11599
116100 submit < T = any > (
117- requestType : Method ,
101+ method : Method ,
118102 parameter ?: string | number ,
119103 form ?: T ,
120104 config ?: AxiosRequestConfig ,
121105 ) : Promise < T > {
122- const method = BaseService . __validateRequestType ( requestType )
106+ BaseService . __validateRequestType ( method )
123107 this . beforeSubmit ( )
124108 return new Promise ( ( resolve , reject ) => {
125109 const data = hasFiles ( form ) ? objectToFormData ( form ) : form
@@ -190,8 +174,6 @@ class BaseService {
190174 return this
191175 }
192176
193- setParameter ( parameter : string ) : this
194- setParameter ( parameter : string , value ?: any ) : this
195177 setParameter ( parameter : string , value ?: any ) : this {
196178 if ( ! value ) {
197179 const options : IParseOptions = Object . assign ( { } , this . $parsedQs , {
@@ -206,8 +188,6 @@ class BaseService {
206188 return this
207189 }
208190
209- removeParameters ( ) : this
210- removeParameters ( parameters : any [ ] ) : this
211191 removeParameters ( parameters = [ ] as any [ ] ) : this {
212192 if ( ! parameters || ! parameters . length ) {
213193 this . parameters = [ ]
0 commit comments