diff options
| author | Zephyrrus <[email protected]> | 2020-07-08 03:13:51 +0300 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2020-07-08 03:13:51 +0300 |
| commit | 1a8b6602e094289a4f477c33e432e0f5e1587b45 (patch) | |
| tree | db6a8a6640b353136933682885a8d834865a3866 /src/site/store | |
| parent | fix: errors in Util caused by separating into different classes improperly (diff) | |
| download | host.fuwn.me-1a8b6602e094289a4f477c33e432e0f5e1587b45.tar.xz host.fuwn.me-1a8b6602e094289a4f477c33e432e0f5e1587b45.zip | |
refactor: change uploader component to use vuex
Diffstat (limited to 'src/site/store')
| -rw-r--r-- | src/site/store/albums.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/site/store/albums.js b/src/site/store/albums.js index 2b4ac60..8441182 100644 --- a/src/site/store/albums.js +++ b/src/site/store/albums.js @@ -5,6 +5,7 @@ export const state = () => ({ isListLoading: false, albumDetails: {}, expandedAlbums: [], + tinyDetails: [], }); export const getters = { @@ -21,7 +22,6 @@ export const actions = { return response; }, - async fetchDetails({ commit }, albumId) { const response = await this.$axios.$get(`album/${albumId}/links`); @@ -34,7 +34,6 @@ export const actions = { return response; }, - async createAlbum({ commit }, name) { const response = await this.$axios.$post('album/new', { name }); @@ -42,7 +41,6 @@ export const actions = { return response; }, - async deleteAlbum({ commit }, albumId) { const response = await this.$axios.$delete(`album/${albumId}`); @@ -50,7 +48,6 @@ export const actions = { return response; }, - async createLink({ commit }, albumId) { const response = await this.$axios.$post('album/link/new', { albumId }); @@ -58,7 +55,6 @@ export const actions = { return response; }, - async updateLinkOptions({ commit }, { albumId, linkOpts }) { const response = await this.$axios.$post('album/link/edit', { identifier: linkOpts.identifier, @@ -70,7 +66,6 @@ export const actions = { return response; }, - async deleteLink({ commit }, { albumId, identifier }) { const response = await this.$axios.$delete(`album/link/delete/${identifier}`); @@ -78,6 +73,13 @@ export const actions = { return response; }, + async getTinyDetails({ commit }) { + const response = await this.$axios.$get('albums/dropdown'); + + commit('setTinyDetails', response); + + return response; + }, }; export const mutations = { @@ -111,7 +113,7 @@ export const mutations = { }, removeAlbumLink(state, { albumId, identifier }) { const foundIndex = state.albumDetails[albumId].links.findIndex(({ identifier: id }) => id === identifier); - state.albumDetails[albumId].links.splice(foundIndex, 1); + if (foundIndex > -1) state.albumDetails[albumId].links.splice(foundIndex, 1); }, toggleExpandedState(state, id) { const foundIndex = state.expandedAlbums.indexOf(id); @@ -121,4 +123,7 @@ export const mutations = { state.expandedAlbums.push(id); } }, + setTinyDetails(state, { albums }) { + state.tinyDetails = albums; + }, }; |