aboutsummaryrefslogtreecommitdiff
path: root/src/site/store
diff options
context:
space:
mode:
authorPitu <[email protected]>2020-12-28 00:10:59 +0900
committerPitu <[email protected]>2020-12-28 00:10:59 +0900
commitedb3bed98864e34695a5ae0093c414a2b578073a (patch)
treec014e52bfc5f24f1f773d51f9306a7138ebdfd8e /src/site/store
parentfix: mobile styling (diff)
downloadhost.fuwn.me-edb3bed98864e34695a5ae0093c414a2b578073a.tar.xz
host.fuwn.me-edb3bed98864e34695a5ae0093c414a2b578073a.zip
feat: Add warning to nsfw albums
Diffstat (limited to 'src/site/store')
-rw-r--r--src/site/store/albums.js12
-rw-r--r--src/site/store/index.js8
2 files changed, 12 insertions, 8 deletions
diff --git a/src/site/store/albums.js b/src/site/store/albums.js
index 8be0230..b109af6 100644
--- a/src/site/store/albums.js
+++ b/src/site/store/albums.js
@@ -73,6 +73,15 @@ export const actions = {
return response;
},
+ async toggleNsfw({ commit }, { albumId, nsfw }) {
+ const response = await this.$axios.$post('album/edit', {
+ id: albumId,
+ nsfw
+ });
+ commit('updateNsfw', { albumId, nsfw });
+
+ return response;
+ },
async deleteLink({ commit }, { albumId, identifier }) {
const response = await this.$axios.$delete(`album/link/delete/${identifier}`);
@@ -118,6 +127,9 @@ export const mutations = {
const link = state.albumDetails[albumId].links[foundIndex];
state.albumDetails[albumId].links[foundIndex] = { ...link, ...linkOpts };
},
+ updateNsfw(state, { albumId, value }) {
+ state.list.find(el => el.id === albumId).nsfw = value;
+ },
removeAlbumLink(state, { albumId, identifier }) {
const foundIndex = state.albumDetails[albumId].links.findIndex(({ identifier: id }) => id === identifier);
if (foundIndex > -1) state.albumDetails[albumId].links.splice(foundIndex, 1);
diff --git a/src/site/store/index.js b/src/site/store/index.js
index c5d9a23..94d673f 100644
--- a/src/site/store/index.js
+++ b/src/site/store/index.js
@@ -1,6 +1,5 @@
import config from '../../../dist/config.json';
-// eslint-disable-next-line import/prefer-default-export
export const actions = {
async nuxtClientInit({ commit, dispatch }) {
commit('config/set', config);
@@ -11,11 +10,4 @@ export const actions = {
commit('auth/setToken', cookies.token);
return dispatch('auth/verify');
}
- /* alert({ commit }, payload) {
- if (!payload) return commit('alert', null);
- commit('alert', {
- text: payload.text,
- error: payload.error
- });
- } */
};