File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import type { CancelableAxiosInstance } from '../client.ts'
77import type { InterceptorErrorHandler } from './index.ts'
88
9- import { generateUrl } from '@nextcloud/router '
9+ import { fetchRequestToken } from '@nextcloud/auth '
1010import { isAxiosError } from 'axios'
1111
1212const RETRY_KEY = '_nextcloudCsrfTokenReloaded'
@@ -31,9 +31,8 @@ export function onCsrfTokenError(axios: CancelableAxiosInstance): InterceptorErr
3131 && response ?. data ?. message === 'CSRF check failed' ) {
3232 console . warn ( `Request to ${ responseURL } failed because of a CSRF mismatch. Fetching a new token.` )
3333
34- const { data : { token } } = await axios . get ( generateUrl ( '/csrftoken' ) )
34+ const token = await fetchRequestToken ( )
3535 axios . defaults . headers . requesttoken = token
36-
3736 return axios ( {
3837 ...config ,
3938 [ RETRY_KEY ] : true ,
You can’t perform that action at this time.
0 commit comments