finisch sharing functionality
This commit is contained in:
@@ -155,8 +155,11 @@ export default {
|
||||
axios.put(context.rootGetters.server + "/api/albums/" + album._id, body, context.rootGetters.headers);
|
||||
},
|
||||
shareEnable(context, album) {
|
||||
axios.post(context.rootGetters.server + "/api/albums/" + album._id + "/share", {}, context.rootGetters.headers).then(res => {
|
||||
album.share = res.data;
|
||||
return new Promise(resolve => {
|
||||
axios.post(context.rootGetters.server + "/api/albums/" + album._id + "/share", {}, context.rootGetters.headers).then(res => {
|
||||
album.share = res.data;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
shareDisable(context, album) {
|
||||
|
||||
@@ -131,8 +131,11 @@ export default {
|
||||
});
|
||||
},
|
||||
shareEnable(context, box) {
|
||||
axios.post(context.rootGetters.server + "/api/boxes/" + box._id + "/share", {}, context.rootGetters.headers).then(res => {
|
||||
box.share = res.data;
|
||||
return new Promise(resolve => {
|
||||
axios.post(context.rootGetters.server + "/api/boxes/" + box._id + "/share", {}, context.rootGetters.headers).then(res => {
|
||||
box.share = res.data;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
shareDisable(context, box) {
|
||||
|
||||
@@ -4,12 +4,23 @@ export default {
|
||||
get(context, id) {
|
||||
return new Promise((resolve) => {
|
||||
axios.get(context.rootGetters.server + "/api/shares/" + id, context.rootGetters.headers).then((res) => {
|
||||
if (res.data.object.type == "album") {
|
||||
console.log(res.data)
|
||||
res.data.object.tracks.forEach(track => {
|
||||
track.parent = res.data.object;
|
||||
track.parentType = "album"
|
||||
});
|
||||
if (!res.data._id) {
|
||||
resolve(res.data);
|
||||
return;
|
||||
}
|
||||
switch (res.data.object.type) {
|
||||
case "album":
|
||||
res.data.object.tracks.forEach(track => {
|
||||
track.parent = res.data.object;
|
||||
track.parentType = "album"
|
||||
});
|
||||
break;
|
||||
case "box":
|
||||
res.data.object.videos.forEach(video => {
|
||||
video.parent = res.data.object;
|
||||
video.parentType = "box"
|
||||
});
|
||||
break;
|
||||
}
|
||||
resolve(res.data);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import router from '../../../router'
|
||||
export default {
|
||||
play(context, video) {
|
||||
context.commit("selectVideo", video);
|
||||
if (context.rootGetters.routerQuery.play != video._id) {
|
||||
if (context.rootGetters.routerQuery.play != video._id && context.rootGetters.routerPath != "/share") {
|
||||
router.push("/boxes?id=" + video.parent._id + "&play=" + video._id);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user