Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const form = document.createElement('form');
- form.setAttribute('method', 'POST');
- form.setAttribute('action', `${environment.serverUrl}/data-files/download/post`);
- const sessionKey = JSON.parse(localStorage.getItem('currentUser')).sessionKey;
- const fileId = fileDto.id;
- const sessionKeyInput = document.createElement('input');
- sessionKeyInput.setAttribute('name', 'sessionKey');
- sessionKeyInput.setAttribute('value', sessionKey);
- form.appendChild(sessionKeyInput);
- const fileIdInput = document.createElement('input');
- fileIdInput.setAttribute('name', 'fileId');
- fileIdInput.setAttribute('value', fileId+"");
- form.appendChild(fileIdInput);
- document.body.appendChild(form);
- form['submit']();
- document.body.removeChild(form);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement