mirror of
https://github.com/nextcloud/server.git
synced 2026-04-04 08:35:50 -04:00
Nevertheless this causes a huge amount of new warnings. Previously the shell script for directories to lint was wrong it was generating all app names to lint, but was missing the `apps/` prefix. Causing only `core` to be linted. Co-authored-by: Grigorii K. Shartsev <me@shgk.me> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
36 lines
796 B
JavaScript
36 lines
796 B
JavaScript
/**
|
|
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
/**
|
|
* Creates a cancelable axios 'request object'.
|
|
*
|
|
* @param {Function} request the axios promise request
|
|
* @return {object}
|
|
*/
|
|
const cancelableRequest = function(request) {
|
|
const controller = new AbortController()
|
|
const signal = controller.signal
|
|
|
|
/**
|
|
* Execute the request
|
|
*
|
|
* @param {string} url the url to send the request to
|
|
* @param {object} [options] optional config for the request
|
|
*/
|
|
const fetch = async function(url, options) {
|
|
const response = await request(
|
|
url,
|
|
Object.assign({ signal }, options),
|
|
)
|
|
return response
|
|
}
|
|
|
|
return {
|
|
request: fetch,
|
|
abort: () => controller.abort(),
|
|
}
|
|
}
|
|
|
|
export default cancelableRequest
|