mirror of
https://github.com/coder/code-server.git
synced 2026-05-07 12:57:26 +02:00
chore(vscode): update to 1.56.0
This commit is contained in:
20
lib/vscode/src/vs/workbench/api/browser/apiCommands.ts
Normal file
20
lib/vscode/src/vs/workbench/api/browser/apiCommands.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
|
||||
if (isWeb) {
|
||||
CommandsRegistry.registerCommand('_workbench.fetchJSON', async function (accessor: ServicesAccessor, url: string, method: string) {
|
||||
const result = await fetch(url, { method, headers: { Accept: 'application/json' } });
|
||||
|
||||
if (result.ok) {
|
||||
return result.json();
|
||||
} else {
|
||||
throw new Error(result.statusText);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user