Skip to content

Commit d33cdb6

Browse files
committed
chore(type): extend any of base service methods
1 parent 5f99daf commit d33cdb6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/core/BaseService.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ class BaseService {
4242
return BaseService.$parsedQs
4343
}
4444

45-
all<T>() {
45+
all<T = any>() {
4646
return this.submit<T>('get')
4747
}
4848

49-
find<T>(id: number | string) {
49+
find<T = any>(id: number | string) {
5050
return this.submit<T>('get', id)
5151
}
5252

53-
post<T>(payload: any, config?: AxiosRequestConfig) {
53+
post<T = any>(payload: any, config?: AxiosRequestConfig) {
5454
return this.submit<T>('post', '', payload, config)
5555
}
5656

57-
store<T>(payload: any, config?: AxiosRequestConfig) {
57+
store<T = any>(payload: any, config?: AxiosRequestConfig) {
5858
return this.post<T>(payload, config)
5959
}
6060

61-
put<T>(id: any, payload?: any, config?: AxiosRequestConfig) {
61+
put<T = any>(id: any, payload?: any, config?: AxiosRequestConfig) {
6262
const parameter = id && !isObject(id) ? `/${id}` : ''
6363
const body = isObject(id) ? id : payload
6464
const requestType: Method = hasFiles(body) ? 'post' : 'put'
@@ -68,21 +68,21 @@ class BaseService {
6868
return this.submit<T>(requestType, parameter, body, config)
6969
}
7070

71-
patch<T>(id: any, payload?: any, config?: AxiosRequestConfig) {
71+
patch<T = any>(id: any, payload?: any, config?: AxiosRequestConfig) {
7272
const parameter = id && !isObject(id) ? `/${id}` : ''
7373
const body = isObject(id) ? id : payload
7474
return this.submit<T>('patch', parameter, body, config)
7575
}
7676

77-
update<T>(id: string | number, payload: any) {
77+
update<T = any>(id: string | number, payload: any) {
7878
return this.patch<T>(id, payload)
7979
}
8080

81-
delete<T>(id: string | number) {
81+
delete<T = any>(id: string | number) {
8282
return this.submit<T>('delete', `/${id}`)
8383
}
8484

85-
remove<T>(id: string | number) {
85+
remove<T = any>(id: string | number) {
8686
return this.delete<T>(id)
8787
}
8888

0 commit comments

Comments
 (0)