在下面的代码中,在uploadEditImageEpic
中,s3options
未定义。这是为什么?它只是从导出对象的文件导入。
组件/ addPage / epic.js
import type { S3Options } from '../../types/image'
export const s3options: S3Options = {
keyPrefix: 'xxxx',
bucket: 'xxx',
region: 'xxx',
accessKey: 'xxx',
secretKey: 'xxx',
successActionStatus: xxx
}
组件/ editProduct / epic.js
import { s3options } from '../addPage/epic'
export const uploadEditImageEpic: Epic<*, *, *> = (
action$: ActionsObservable<*>
) =>
action$.ofType(UPLOAD_EDIT_IMAGE).mergeMap(action => {
return Observable.fromPromise(RNS3.put(action.payload, s3options))
.map((response: AjaxResponse) => uploadEditImageFulfilled(response))
.catch((error: AjaxResponse) => {
return Observable.of(uploadEditImageRejected(error))
})
})
类型/ image.js
export type S3Options = {
[x: string]: any,
keyPrefix: string,
bucket: string,
region: string,
accessKey: string,
secretKey: string,
successActionStatus: number
}