-
-
-
-
-
-
-
-
-
-
-
-
- {{ selectedBox.title }}
-
- {{ box_videos.length }} Videos
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ selectedBox.title }}
+
+ {{ box_videos.length }} Videos
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -168,8 +173,11 @@ export default {
resetCover() {
this.$store.dispatch("boxes/resetCover", this.selectedBox);
},
- share() {
- this.$store.dispatch("boxes/share", this.selectedBox);
+ shareEnable() {
+ this.$store.dispatch("boxes/shareEnable", this.selectedBox);
+ },
+ shareDisable() {
+ this.$store.dispatch("boxes/shareDisable", this.selectedBox);
},
},
computed: {
diff --git a/src/store/modules/albums/actions.js b/src/store/modules/albums/actions.js
index 77d3db1..b2496d4 100644
--- a/src/store/modules/albums/actions.js
+++ b/src/store/modules/albums/actions.js
@@ -154,11 +154,14 @@ export default {
}
axios.put(context.rootGetters.server + "/api/albums/" + album._id, body, context.rootGetters.headers);
},
- share(context, album) {
- return new Promise((resolve) => {
- axios.get(context.rootGetters.server + "/api/albums/" + album._id + "/share", context.rootGetters.headers).then(res => {
- resolve(res.data);
- });
- })
+ shareEnable(context, album) {
+ axios.post(context.rootGetters.server + "/api/albums/" + album._id + "/share", {}, context.rootGetters.headers).then(res => {
+ album.share = res.data;
+ });
+ },
+ shareDisable(context, album) {
+ axios.delete(context.rootGetters.server + "/api/albums/" + album._id + "/share", context.rootGetters.headers).then(() => {
+ album.share = {};
+ });
}
}
\ No newline at end of file
diff --git a/src/store/modules/albums/mutations.js b/src/store/modules/albums/mutations.js
index 6b1384c..dafa403 100644
--- a/src/store/modules/albums/mutations.js
+++ b/src/store/modules/albums/mutations.js
@@ -59,6 +59,7 @@ export default {
} else if (existsAlbum && album.tracks.length > 0) {
existsAlbum.covers = album.covers || {};
+ existsAlbum.share = album.share;
existsAlbum.tracks = album.tracks;
existsAlbum.tracks.forEach((track) => {
track.parent = existsAlbum;
diff --git a/src/store/modules/albums/state.js b/src/store/modules/albums/state.js
index 6dd41cd..e504bbe 100644
--- a/src/store/modules/albums/state.js
+++ b/src/store/modules/albums/state.js
@@ -1,7 +1,7 @@
export default {
collection: [],
newest: [],
- selectedAlbum: { tracks: [], covers: {} },
+ selectedAlbum: { tracks: [], covers: {}, share: {} },
page: 1,
loading: false,
eos: false
diff --git a/src/store/modules/boxes/actions.js b/src/store/modules/boxes/actions.js
index b8e0b90..ba5ef48 100644
--- a/src/store/modules/boxes/actions.js
+++ b/src/store/modules/boxes/actions.js
@@ -130,4 +130,14 @@ export default {
box.covers = {}
});
},
+ shareEnable(context, box) {
+ axios.post(context.rootGetters.server + "/api/boxes/" + box._id + "/share", {}, context.rootGetters.headers).then(res => {
+ box.share = res.data;
+ });
+ },
+ shareDisable(context, box) {
+ axios.delete(context.rootGetters.server + "/api/boxes/" + box._id + "/share", context.rootGetters.headers).then(() => {
+ box.share = {};
+ });
+ }
}
\ No newline at end of file
diff --git a/src/store/modules/boxes/mutations.js b/src/store/modules/boxes/mutations.js
index 3ce0166..0f2e27c 100644
--- a/src/store/modules/boxes/mutations.js
+++ b/src/store/modules/boxes/mutations.js
@@ -50,6 +50,7 @@ export default {
});
} else if (existsBox && box.videos.length > 0) {
existsBox.covers = box.covers || {};
+ existsBox.share = box.share;
existsBox.videos = box.videos;
existsBox.videos.forEach((video) => {
video.parent = existsBox;
diff --git a/src/store/modules/boxes/state.js b/src/store/modules/boxes/state.js
index c23a06d..21705b4 100644
--- a/src/store/modules/boxes/state.js
+++ b/src/store/modules/boxes/state.js
@@ -1,7 +1,7 @@
export default {
collection: [],
newest: [],
- selectedBox: { videos: [], covers: {} },
+ selectedBox: { videos: [], covers: {}, share: {} },
page: 1,
loading: false,
eos: false