Skip to content

Commit d4a4236

Browse files
committed
docs: simplify example
1 parent 0666e56 commit d4a4236

File tree

1 file changed

+1
-7
lines changed
  • 16/umbraco-cms/customizing/foundation/fetching-data

1 file changed

+1
-7
lines changed

16/umbraco-cms/customizing/foundation/fetching-data/fetch-api.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,12 @@ The following example demonstrates how to use `UMB_AUTH_CONTEXT` to retrieve the
4848

4949
```javascript
5050
import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth';
51-
import type { UmbClassInterface } from '@umbraco-cms/backoffice/class-api';
5251

53-
async function fetchData(host: UmbClassInterface, endpoint: string) {
54-
// Retrieve the authentication context
52+
async function fetchData(host, endpoint) {
5553
const authContext = await host.getContext(UMB_AUTH_CONTEXT);
56-
57-
// Get the latest token
5854
const token = await authContext?.getLatestToken();
5955

60-
// Make the authenticated request
6156
const response = await fetch(endpoint, {
62-
method: 'GET',
6357
headers: {
6458
'Authorization': `Bearer ${token}`,
6559
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)