1
1
import React from "react"
2
- import { actions , init , reducer } from "./reducer"
2
+ import { actionTypes , init , reducer } from "./reducer"
3
3
4
4
let PropTypes
5
5
try {
@@ -83,7 +83,7 @@ export const createInstance = (defaultProps = {}, displayName = "Async") => {
83
83
this . abortController = new window . AbortController ( )
84
84
}
85
85
this . counter ++
86
- this . dispatch ( { type : actions . start , meta : { counter : this . counter } } )
86
+ this . dispatch ( { type : actionTypes . start , meta : { counter : this . counter } } )
87
87
}
88
88
89
89
load ( ) {
@@ -118,7 +118,7 @@ export const createInstance = (defaultProps = {}, displayName = "Async") => {
118
118
cancel ( ) {
119
119
this . counter ++
120
120
this . abortController . abort ( )
121
- this . dispatch ( { type : actions . cancel , meta : { counter : this . counter } } )
121
+ this . dispatch ( { type : actionTypes . cancel , meta : { counter : this . counter } } )
122
122
}
123
123
124
124
onResolve ( counter ) {
@@ -142,12 +142,13 @@ export const createInstance = (defaultProps = {}, displayName = "Async") => {
142
142
}
143
143
144
144
setData ( data , callback ) {
145
- this . mounted && this . dispatch ( { type : actions . fulfill , payload : data } , callback )
145
+ this . mounted && this . dispatch ( { type : actionTypes . fulfill , payload : data } , callback )
146
146
return data
147
147
}
148
148
149
149
setError ( error , callback ) {
150
- this . mounted && this . dispatch ( { type : actions . reject , payload : error , error : true } , callback )
150
+ this . mounted &&
151
+ this . dispatch ( { type : actionTypes . reject , payload : error , error : true } , callback )
151
152
return error
152
153
}
153
154
0 commit comments