aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/jquery/requesttoken.js
blob: c2868e2728ac5780235b87d6c948a01e2512df82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

import $ from 'jquery'

import { getToken } from '../OC/requesttoken.js'

$(document).on('ajaxSend', function(elm, xhr, settings) {
	if (settings.crossDomain === false) {
		xhr.setRequestHeader('requesttoken', getToken())
		xhr.setRequestHeader('OCS-APIREQUEST', 'true')
	}
})