File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,20 @@ import { createClient } from 'webdav'
2424import { getRootPath , getToken , isPublic } from '../utils/davUtils'
2525import { getRequestToken } from '@nextcloud/auth'
2626
27- const headers = {
28- // Add this so the server knows it is an request from the browser
29- 'X-Requested-With' : 'XMLHttpRequest' ,
30- // Add the request token to the request
31- requesttoken : getRequestToken ( ) || '' ,
27+ // Use a method for the headers, to always get the current request token
28+ const getHeaders = ( ) => {
29+ return {
30+ // Add this so the server knows it is an request from the browser
31+ 'X-Requested-With' : 'XMLHttpRequest' ,
32+ // Add the request token to the request
33+ requesttoken : getRequestToken ( ) || '' ,
34+ }
3235}
3336
3437export const getClient = ( ) => {
3538 const client = createClient ( getRootPath ( ) , isPublic ( )
36- ? { username : getToken ( ) , password : '' , headers }
37- : { headers } ,
39+ ? { username : getToken ( ) , password : '' , headers : getHeaders ( ) }
40+ : { headers : getHeaders ( ) } ,
3841 )
3942
4043 return client
You can’t perform that action at this time.
0 commit comments