Call newPost message on the server

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/18/head
Julius Härtl 2018-11-15 12:54:16 +01:00
rodzic 3436246ec8
commit 101795d5b0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4C614C6ED2CDE6DF
2 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -25,7 +25,7 @@
<div class="new-post-author">
<avatar :user="currentUser.uid" :display-name="currentUser.displayName" :size="32" />
</div>
<form class="new-post-form">
<form class="new-post-form" v-on:submit.prevent="createPost">
<div class="author currentUser">
{{ currentUser.displayName }}
<span class="social-id">{{ socialId }}</span>
@ -237,7 +237,7 @@ export default {
return 'icon-contacts-dark';
case 'direct':
return 'icon-external';
case 'private':
case 'unlisted':
return 'icon-password';
}
}
@ -260,9 +260,9 @@ export default {
text: 'Followers'
},
{
action: () => { this.switchType('private') },
icon: this.visibilityIconClass('private'),
text: 'Private'
action: () => { this.switchType('unlisted') },
icon: this.visibilityIconClass('unlisted'),
text: 'Unlisted'
}
]
}
@ -281,6 +281,13 @@ export default {
switchType(type) {
this.type = type;
this.menuOpened = false;
},
createPost(event) {
this.$store.dispatch('post', {
content: this.post,
type: this.type,
}).then((response) => { response.length > 0 ? $state.loaded() : $state.complete() });
event.preventDefault()
}
},
data() {

Wyświetl plik

@ -41,8 +41,7 @@ const getters = {
}
const actions = {
post(context, post) {
axios.post(OC.generateUrl('apps/social/api/v1/post')).then((response) => {
// FIXME: post composition is done in #18
axios.post(OC.generateUrl('apps/social/api/v1/post'), {data: post}).then((response) => {
let uid = ''
context.commit('addPost', { uid: uid, data: response.data })
})