finisch sharing functionality
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Artem Anufrij
2023-02-16 23:59:01 +01:00
parent efef863e66
commit 4d4fb4b4e9
13 changed files with 567 additions and 110 deletions

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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);
});

View File

@@ -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);
}
},