SHARE
TWEET

Untitled

a guest Jan 24th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     const form = document.createElement('form');
  2.     form.setAttribute('method', 'POST');
  3.     form.setAttribute('action', `${environment.serverUrl}/data-files/download/post`);
  4.     const sessionKey = JSON.parse(localStorage.getItem('currentUser')).sessionKey;
  5.     const fileId = fileDto.id;
  6.  
  7.     const sessionKeyInput = document.createElement('input');
  8.     sessionKeyInput.setAttribute('name', 'sessionKey');
  9.     sessionKeyInput.setAttribute('value', sessionKey);
  10.     form.appendChild(sessionKeyInput);
  11.  
  12.     const fileIdInput = document.createElement('input');
  13.     fileIdInput.setAttribute('name', 'fileId');
  14.     fileIdInput.setAttribute('value', fileId+"");
  15.     form.appendChild(fileIdInput);
  16.  
  17.     document.body.appendChild(form);
  18.     form['submit']();
  19.     document.body.removeChild(form);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top