👌 IMPROVE: immediate UI feedback / button change for successful boost/unboost

Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
pull/462/head
Jonas Sulzer 2019-04-23 20:47:45 +02:00 zatwierdzone przez Maxence Lange
rodzic cb408e8fb3
commit d9c37be5ec
1 zmienionych plików z 2 dodań i 0 usunięć
src/store

Wyświetl plik

@ -99,6 +99,7 @@ const actions = {
postBoost(context, post) {
return new Promise((resolve, reject) => {
axios.post(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
post.action.values.boosted = true
// eslint-disable-next-line no-console
console.log('Post boosted with token ' + response.data.result.token)
resolve(response)
@ -112,6 +113,7 @@ const actions = {
postUnBoost(context, post) {
return axios.delete(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
context.commit('removeBoost', post)
post.action.values.boosted = false
// eslint-disable-next-line no-console
console.log('Boost deleted with token ' + response.data.result.token)
}).catch((error) => {