· 7 years ago · Feb 09, 2018, 09:30 PM
1import type { S3Options } from '../../types/image'
2
3export const s3options: S3Options = {
4 keyPrefix: 'xxxx',
5 bucket: 'xxx',
6 region: 'xxx',
7 accessKey: 'xxx',
8 secretKey: 'xxx',
9 successActionStatus: xxx
10}
11
12import { s3options } from '../addPage/epic'
13
14export const uploadEditImageEpic: Epic<*, *, *> = (
15 action$: ActionsObservable<*>
16) =>
17 action$.ofType(UPLOAD_EDIT_IMAGE).mergeMap(action => {
18 return Observable.fromPromise(RNS3.put(action.payload, s3options))
19 .map((response: AjaxResponse) => uploadEditImageFulfilled(response))
20 .catch((error: AjaxResponse) => {
21 return Observable.of(uploadEditImageRejected(error))
22 })
23 })
24
25export type S3Options = {
26 [x: string]: any,
27 keyPrefix: string,
28 bucket: string,
29 region: string,
30 accessKey: string,
31 secretKey: string,
32 successActionStatus: number
33}