diff options
| author | Zephyrrus <[email protected]> | 2020-07-19 22:27:11 +0300 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2020-07-19 22:27:11 +0300 |
| commit | c93ddb09008c45942544b13bbb03319c367f9cd8 (patch) | |
| tree | 7f6e334b8d33b42574dc19a256a944fadbaa7f66 /src/site/store/images.js | |
| parent | chore: add custom class to inputs until fix is released on buefy's master (diff) | |
| download | host.fuwn.me-c93ddb09008c45942544b13bbb03319c367f9cd8.tar.xz host.fuwn.me-c93ddb09008c45942544b13bbb03319c367f9cd8.zip | |
feat: Start working on a new album/tags/image info modal
Diffstat (limited to 'src/site/store/images.js')
| -rw-r--r-- | src/site/store/images.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/site/store/images.js b/src/site/store/images.js index acac286..0d5e82a 100644 --- a/src/site/store/images.js +++ b/src/site/store/images.js @@ -8,10 +8,11 @@ export const getDefaultState = () => ({ limit: 30, totalFiles: 0, }, - name: null, - downloadEnabled: false, + albumName: null, + albumDownloadEnabled: false, + fileExtraInfoMap: {}, // information about the selected file fileAlbumsMap: {}, // map of file ids with a list of album objects the file is in - filesTags: {}, // map of file ids with a list of tag objects for the file + fileTagsMap: {}, // map of file ids with a list of tag objects for the file }); export const state = getDefaultState; @@ -55,6 +56,15 @@ export const actions = { return response; }, + async fetchFileMeta({ commit }, fileId) { + const response = await this.$axios.$get(`file/${fileId}`); + + commit('setFileAlbums', { ...response, fileId }); + commit('setFileTags', { ...response, fileId }); + commit('setFileExtraInfo', { ...response, fileId }); + + return response; + }, async getFileAlbums({ commit }, fileId) { const response = await this.$axios.$get(`file/${fileId}/albums`); @@ -90,10 +100,11 @@ export const mutations = { state.isLoading = true; }, setFilesAndMeta(state, { - files, name, page, count, + files, name, page, count, downloadEnabled, }) { state.files = files || []; - state.name = name ?? null; + state.albumName = name ?? null; + state.downloadEnabled = downloadEnabled ?? false; state.isLoading = false; state.pagination.page = page || 1; state.pagination.totalFiles = count || 0; @@ -108,6 +119,12 @@ export const mutations = { setFileAlbums(state, { fileId, albums }) { Vue.set(state.fileAlbumsMap, fileId, albums); }, + setFileTags(state, { fileId, tags }) { + Vue.set(state.fileTagsMap, fileId, tags); + }, + setFileExtraInfo(state, { fileId, file }) { + Vue.set(state.fileExtraInfoMap, fileId, file); + }, addAlbumToFile(state, { fileId, album }) { if (!state.fileAlbumsMap[fileId]) return; |