11import React from "react"
2- import { actions , init , reducer } from "./reducer"
2+ import { actionTypes , init , reducer } from "./reducer"
33
44let PropTypes
55try {
@@ -83,7 +83,7 @@ export const createInstance = (defaultProps = {}, displayName = "Async") => {
8383 this . abortController = new window . AbortController ( )
8484 }
8585 this . counter ++
86- this . dispatch ( { type : actions . start , meta : { counter : this . counter } } )
86+ this . dispatch ( { type : actionTypes . start , meta : { counter : this . counter } } )
8787 }
8888
8989 load ( ) {
@@ -118,7 +118,7 @@ export const createInstance = (defaultProps = {}, displayName = "Async") => {
118118 cancel ( ) {
119119 this . counter ++
120120 this . abortController . abort ( )
121- this . dispatch ( { type : actions . cancel , meta : { counter : this . counter } } )
121+ this . dispatch ( { type : actionTypes . cancel , meta : { counter : this . counter } } )
122122 }
123123
124124 onResolve ( counter ) {
@@ -142,12 +142,13 @@ export const createInstance = (defaultProps = {}, displayName = "Async") => {
142142 }
143143
144144 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 )
146146 return data
147147 }
148148
149149 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 )
151152 return error
152153 }
153154
0 commit comments