99 lines
2.4 KiB
JavaScript
99 lines
2.4 KiB
JavaScript
import chatApi from "~/apis/chatApi";
|
|
import repoApi from "~/apis/repoApi";
|
|
|
|
export default {
|
|
methods: {
|
|
async saveForward() {
|
|
let payload = {
|
|
group_id: this.getForwardItem.to.id,
|
|
forward_from: this.getForwardItem?.message.id,
|
|
};
|
|
|
|
// private route condition
|
|
if (this.$route.name == "privates") {
|
|
payload = {
|
|
// contact_id: this.getForwardItem.user.user_id,
|
|
contact_id: this.getForwardItem.to.user_id,
|
|
forward_from: this.getForwardItem?.message.id,
|
|
};
|
|
}
|
|
|
|
let url = "message/" + chatApi.messages.create;
|
|
|
|
return await this.httpService.formDataRequest(url, payload);
|
|
},
|
|
|
|
forwardTo(user) {
|
|
this.save(user);
|
|
},
|
|
openForwardModal(comment) {
|
|
const forwardItem = {
|
|
from: this.listGetter,
|
|
to: {},
|
|
message: comment,
|
|
};
|
|
|
|
// comment.group_forward_from_id = this.listGetter.id;
|
|
// comment.group_forward_from_title = this.listGetter.title;
|
|
|
|
this.SET_FORWARD_ITEM(forwardItem);
|
|
this.showForwardModal = true;
|
|
this.modalComponentName = "user-search";
|
|
|
|
setTimeout(() => {
|
|
$("#base-modal").modal({
|
|
backdrop: "static",
|
|
keyboard: false,
|
|
show: true,
|
|
});
|
|
}, 200);
|
|
},
|
|
redirectToPrivates(routeName) {
|
|
this.closeForwardModal();
|
|
setTimeout(() => {
|
|
this.$router
|
|
.push({
|
|
name: routeName,
|
|
})
|
|
.catch((err) => {
|
|
|
|
});
|
|
}, 500);
|
|
|
|
// if (this.getForwardItem.type == 'Private') {
|
|
// this.$router
|
|
// .push({
|
|
// name: routeName,
|
|
// meta: {
|
|
// "user-id": this.getForwardItem?.message.user.id,
|
|
// "message-id": this.getForwardItem?.message.id,
|
|
// },
|
|
// })
|
|
// .then(() => {}).catch(()=>{})
|
|
// } else if (this.getForwardItem.type == "Group") {
|
|
|
|
// this.$router
|
|
// .push({
|
|
// name: routeName,
|
|
// })
|
|
// .then(() => {}).catch(()=>{})
|
|
// }
|
|
},
|
|
closeForwardModal() {
|
|
$("#base-modal").modal("hide");
|
|
|
|
setTimeout(() => {
|
|
this.showForwardModal = false;
|
|
}, 500);
|
|
},
|
|
closeAndResetForwardModal() {
|
|
this.SET_FORWARD_ITEM();
|
|
$("#base-modal").modal("hide");
|
|
|
|
setTimeout(() => {
|
|
this.showForwardModal = false;
|
|
}, 500);
|
|
},
|
|
},
|
|
};
|