make popup window removed video token and cookie when it is closed. Fixed mobile context menu not being able to download files

This commit is contained in:
kyle hoell
2020-11-27 17:53:15 -05:00
parent 9dbddb244e
commit f6fbada5b1
6 changed files with 72 additions and 14 deletions
+25 -8
View File
@@ -79,14 +79,11 @@ class MobileContextMenuContainer extends React.Component {
this.props.dispatch(setLastSelected(0));
axios.get(currentURL +'/file-service/download/get-token')
.then((response) => {
const tempToken = response.data.tempToken;
axios.post("/user-service/get-token").then((response) => {
const finalUrl =
isGoogle ? !isGoogleDoc ? currentURL + `/file-service-google/download/${fileID}/${tempToken}` : currentURL + `/file-service-google-doc/download/${fileID}/${tempToken}`
: !isPersonal ? currentURL + `/file-service/download/${fileID}/${tempToken}` : currentURL + `/file-service-personal/download/${fileID}/${tempToken}`
isGoogle ? !isGoogleDoc ? currentURL + `/file-service-google/download/${fileID}` : currentURL + `/file-service-google-doc/download/${fileID}`
: !isPersonal ? currentURL + `/file-service/download/${fileID}` : currentURL + `/file-service-personal/download/${fileID}`
const link = document.createElement('a');
document.body.appendChild(link);
@@ -95,9 +92,29 @@ class MobileContextMenuContainer extends React.Component {
link.setAttribute("download", true);
link.click();
}).catch((err) => {
console.log(err)
}).catch((e) => {
console.log("Download file get refresh token error", e);
})
// axios.get(currentURL +'/file-service/download/get-token')
// .then((response) => {
// const tempToken = response.data.tempToken;
// const finalUrl =
// isGoogle ? !isGoogleDoc ? currentURL + `/file-service-google/download/${fileID}/${tempToken}` : currentURL + `/file-service-google-doc/download/${fileID}/${tempToken}`
// : !isPersonal ? currentURL + `/file-service/download/${fileID}/${tempToken}` : currentURL + `/file-service-personal/download/${fileID}/${tempToken}`
// const link = document.createElement('a');
// document.body.appendChild(link);
// link.href = finalUrl;
// link.setAttribute('type', 'hidden');
// link.setAttribute("download", true);
// link.click();
// }).catch((err) => {
// console.log(err)
// })
}
moveOnClick = () => {
+4 -3
View File
@@ -150,13 +150,14 @@ class PopupWindowContainer extends React.Component {
componentWillUnmount = () => {
const uuidID = window.sessionStorage.getItem("uuid");
document.removeEventListener('mousedown', this.handleClickOutside);
if (this.props.popupFile.metadata.isVideo) {
axios.delete(currentURL +`/file-service/remove/token-video/${this.tempToken}/${uuidID}`, {
axios.delete(`/file-service/remove-stream-video-token`).then(() => {
console.log("removed video access token");
}).catch((err) => {
console.log(err);
})