diff --git a/src/services/list.js b/src/services/list.js index 41bb3345a..22d73088a 100644 --- a/src/services/list.js +++ b/src/services/list.js @@ -56,4 +56,19 @@ export default class ListService extends AbstractService { return e }) } + + removeBackground(list) { + const cancel = this.setLoading() + + return this.http.delete(`/lists/${list.id}/background`, list) + .then(response => { + return Promise.resolve(response.data) + }) + .catch(error => { + return this.errorHandler(error) + }) + .finally(() => { + cancel() + }) + } } \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index 20523175f..46a88ca06 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -103,6 +103,10 @@ export const store = new Vuex.Store({ } } + if (typeof currentList.backgroundInformation === 'undefined' || currentList.backgroundInformation === null) { + state.background = null + } + // Server updates don't return the right. Therefore the right is reset after updating the list which is // confusing because all the buttons will disappear in that case. To prevent this, we're keeping the right // when updating the list in global state. diff --git a/src/views/list/settings/background.vue b/src/views/list/settings/background.vue index 0c22b759e..689905de6 100644 --- a/src/views/list/settings/background.vue +++ b/src/views/list/settings/background.vue @@ -6,6 +6,8 @@ class="list-background-setting" :wide="true" v-if="uploadBackgroundEnabled || unsplashBackgroundEnabled" + :tertary="hasBackground ? 'Remove Background' : ''" + @tertary="removeBackground()" >
- {{ backgroundService.loading ? 'Loading...' : 'Load more photos'}} + {{ backgroundService.loading ? 'Loading...' : 'Load more photos' }}