|
|
@ -14,6 +14,7 @@ interface CreatePostResponse { |
|
|
|
} |
|
|
|
|
|
|
|
interface CreatePostOptions { |
|
|
|
installation: string |
|
|
|
visible: boolean |
|
|
|
text?: string |
|
|
|
cover?: string |
|
|
@ -24,7 +25,7 @@ interface CreatePostOptions { |
|
|
|
|
|
|
|
export const createPost = (options: CreatePostOptions): AppThunkAction<string> => { |
|
|
|
return async dispatch => { |
|
|
|
const { visible, text, cover, attachments, data, parent } = options |
|
|
|
const { installation, visible, text, cover, attachments, data, parent } = options |
|
|
|
dispatch(startRequest(RequestKey.CreatePost)) |
|
|
|
|
|
|
|
try { |
|
|
@ -32,6 +33,7 @@ export const createPost = (options: CreatePostOptions): AppThunkAction<string> = |
|
|
|
path: `/api/post`, |
|
|
|
method: 'post', |
|
|
|
body: { |
|
|
|
installation, |
|
|
|
visible, |
|
|
|
text, |
|
|
|
cover, |
|
|
@ -153,9 +155,9 @@ export const fetchUserPosts = (id: string, continuation?: string): AppThunkActio |
|
|
|
dispatch(setEntities(posts.entities)) |
|
|
|
|
|
|
|
if (continuation) { |
|
|
|
dispatch(listAppend(`posts:${id}`, posts.keys, response.continuation)) |
|
|
|
dispatch(listAppend(`user:${id}:posts`, posts.keys, response.continuation)) |
|
|
|
} else { |
|
|
|
dispatch(listSet(`posts:${id}`, posts.keys, response.continuation)) |
|
|
|
dispatch(listSet(`user:${id}:posts`, posts.keys, response.continuation)) |
|
|
|
} |
|
|
|
|
|
|
|
dispatch(finishRequest(RequestKey.FetchUserPosts, true)) |
|
|
|