File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
16/umbraco-cms/customizing/foundation/fetching-data Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -48,18 +48,12 @@ The following example demonstrates how to use `UMB_AUTH_CONTEXT` to retrieve the
4848
4949``` javascript
5050import { 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' ,
You can’t perform that action at this time.
0 commit comments