Skip to content

Commit f3153c1

Browse files
committed
fix: set OC.requestToken after /csrftoken
Signed-off-by: FlyInWind <2518509078@qq.com>
1 parent 3754884 commit f3153c1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/interceptors/csrf-token.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import type { CancelableAxiosInstance } from '../client.ts'
77
import type { InterceptorErrorHandler } from './index.ts'
88

9+
import { emit } from '@nextcloud/event-bus'
910
import { generateUrl } from '@nextcloud/router'
1011
import { isAxiosError } from 'axios'
1112

@@ -35,6 +36,7 @@ export function onCsrfTokenError(axios: CancelableAxiosInstance): InterceptorErr
3536
const { data: { token } } = await axios.get(generateUrl('/csrftoken'))
3637
console.debug(`New request token ${token} fetched`)
3738
axios.defaults.headers.requesttoken = token
39+
emit('csrf-token-update', { token })
3840

3941
return axios({
4042
...config,

0 commit comments

Comments
 (0)