You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 16/umbraco-cms/customizing/extending-overview/extension-types/dashboard.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,9 @@ The dashboard manifest can contain the following properties:
101
101
| elementName | string | (Optional) The name of the Web Component that contains the dashboard (only if not a default export) |
102
102
| weight | number | (Optional) The weight of the dashboard, higher numbers are displayed first |
103
103
| meta | object | <p>Additional metadata for the dashboard</p><table><thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Label</td><td>string</td><td>The label shown to the user</td></tr><tr><td>pathname</td><td>string</td><td>The routable URL pathname</td></tr></tbody></table> |
104
+
| Property | Type | Description |
105
+
| Label | string | The label shown to the user |
106
+
| pathname | string | The routable URL pathname |
104
107
| conditions | array | (Optional) [Conditions](condition.md) for when the dashboard should be displayed |
Copy file name to clipboardExpand all lines: 16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-context.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ export const My_COUNTER_CONTEXT = new UmbContextToken<MyContextCounterApi>(
67
67
);
68
68
```
69
69
70
-
It is recommended to use `UmbWorkspaceContext` as the Context Alias for your Context Token. This will ensure that the requester only retrieves this Context if it's present at their nearest Workspace Context. Use the Extension Manifest Alias as the API Alias for your Context Token to ensure its unique. For more information, see the [Context API](../../../foundation/working-with-data/context-api.md) article.
70
+
It is recommended to use `UmbWorkspaceContext` as the Context Alias for your Context Token. This will ensure that the requester only retrieves this Context if it's present at their nearest Workspace Context. Use the Extension Manifest Alias as the API Alias for your Context Token to ensure its unique. For more information, see the [Context API](../../../foundation/context-api/) article.
Copy file name to clipboardExpand all lines: 16/umbraco-cms/customizing/foundation/fetching-data/fetch-api.md
+16-15Lines changed: 16 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
---
2
-
description: The Fetch API is a modern way to make network requests in JavaScript. It provides a more powerful and flexible feature set than the older XMLHttpRequest.
2
+
description: >-
3
+
The Fetch API is a modern way to make network requests in JavaScript. It
4
+
provides a more powerful and flexible feature set than the older
5
+
XMLHttpRequest.
3
6
---
4
7
5
8
# Fetch API
@@ -8,12 +11,12 @@ The [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) is a
8
11
9
12
## Fetch API in Umbraco
10
13
11
-
The Fetch API can also be used in Umbraco to make network requests to the server. Since it is built into the browser, you do not need to install any additional libraries or packages to use it. The Fetch API is available in the global scope and can be used directly in your JavaScript code.
14
+
The Fetch API can also be used in Umbraco to make network requests to the server. Since it is built into the browser, you do not need to install any additional libraries or packages to use it. The Fetch API is available in the global scope and can be used directly in your JavaScript code.\
12
15
The Fetch API is a great way to make network requests in Umbraco because it provides a lot of flexibility. You can use it to make GET, POST, PUT, DELETE, and other types of requests to the server. You can also use it to handle responses in a variety of formats, including JSON, text, and binary data.
13
16
14
17
### Example
15
18
16
-
For this example, we are using the Fetch API to make a GET request to the `/umbraco/MyApiController/GetData` endpoint. The response is then parsed as JSON and logged to the console.
19
+
For this example, we are using the Fetch API to make a GET request to the `/umbraco/MyApiController/GetData` endpoint. The response is then parsed as JSON and logged to the console.
17
20
18
21
{% hint style="info" %}
19
22
The example assumes that you have a controller set up at the `/umbraco/MyApiController/GetData` endpoint that returns JSON data. You can replace this with your own endpoint as needed. Read more about creating a controller in the [Controllers](../../../implementation/controllers.md) article.
@@ -38,7 +41,6 @@ if (data) {
38
41
}
39
42
```
40
43
41
-
42
44
{% hint style="warning" %}
43
45
When using the Fetch API, you need to manually handle errors and authentication. For most scenarios, we recommend using the Umbraco HTTP Client, which provides built-in error handling and authentication.
44
46
{% endhint %}
@@ -47,7 +49,7 @@ When using the Fetch API, you need to manually handle errors and authentication.
47
49
48
50
When making requests to the Umbraco API controllers, you may need to include an authorization token in the request headers. This is especially important when making requests to endpoints that require authentication.
49
51
50
-
The Fetch API does not automatically include authentication tokens in requests. You need to manually add the authentication token to the request headers. While you can manage tokens manually, the recommended approach in the Backoffice is to use the **UMB_AUTH_CONTEXT**. This context provides tools to manage authentication tokens and ensures that your requests are properly authenticated.
52
+
The Fetch API does not automatically include authentication tokens in requests. You need to manually add the authentication token to the request headers. While you can manage tokens manually, the recommended approach in the Backoffice is to use the **UMB\_AUTH\_CONTEXT**. This context provides tools to manage authentication tokens and ensures that your requests are properly authenticated.
51
53
52
54
### Example: Using `UMB_AUTH_CONTEXT` for Authentication
53
55
@@ -83,19 +85,18 @@ const data = await fetchData(this, '/umbraco/management/api/v1/server/status');
83
85
console.log(data);
84
86
```
85
87
86
-
87
88
{% hint style="warning" %}
88
89
When using the Fetch API with `UMB_AUTH_CONTEXT`, you need to handle token expiration errors manually. If the token is expired, the request will return a 401 error. You will need to refresh the token or prompt the user to log in again.
89
90
{% endhint %}
90
91
91
-
Why Use **UMB_AUTH_CONTEXT**?
92
+
Why Use **UMB\_AUTH\_CONTEXT**?
92
93
93
-
- Simplifies Token Management: Automatically retrieves and refreshes tokens when needed.
94
-
- Aligns with Best Practices: Ensures your requests are authenticated in a way that integrates seamlessly with the Backoffice.
95
-
- Reduces Errors: Avoids common pitfalls like expired tokens or incorrect headers.
94
+
* Simplifies Token Management: Automatically retrieves and refreshes tokens when needed.
95
+
* Aligns with Best Practices: Ensures your requests are authenticated in a way that integrates seamlessly with the Backoffice.
96
+
* Reduces Errors: Avoids common pitfalls like expired tokens or incorrect headers.
96
97
97
98
{% hint style="info" %}
98
-
The **UMB_AUTH_CONTEXT** is only available in the Backoffice. For external applications, you will need to manage tokens manually or use an API user. Read more about API users in the [API Users](../../../fundamentals/data/users/api-users.md) article.
99
+
The **UMB\_AUTH\_CONTEXT** is only available in the Backoffice. For external applications, you will need to manage tokens manually or use an API user. Read more about API users in the [API Users](../../../fundamentals/data/users/api-users.md) article.
99
100
{% endhint %}
100
101
101
102
## Management API Controllers
@@ -112,11 +113,11 @@ You can read more about this concept in the [API Users](../../../fundamentals/da
112
113
113
114
The Fetch API can also be used to make requests to the Management API using a Backoffice token. This is useful for making requests from custom components that are running in the Backoffice. The concept is similar to the API Users, but the Backoffice token represents the current user in the Backoffice. You will share the access policies of the current user, so you can use the token to make requests on behalf of the current user.
114
115
115
-
To use the Backoffice access token, you will have to consume the **UMB_AUTH_CONTEXT** context. This context is only available in the Backoffice and includes tools to hook on to the authentication process. You can use the [getOpenApiConfiguration](https://apidocs.umbraco.com/v16/ui-api/classes/packages_core_auth.UmbAuthContext.html#getopenapiconfiguration) method to get a configuration object that includes a few useful properties:
116
+
To use the Backoffice access token, you will have to consume the **UMB\_AUTH\_CONTEXT** context. This context is only available in the Backoffice and includes tools to hook on to the authentication process. You can use the [getOpenApiConfiguration](https://apidocs.umbraco.com/v16/ui-api/classes/packages_core_auth.UmbAuthContext.html#getopenapiconfiguration) method to get a configuration object that includes a few useful properties:
116
117
117
-
-`base`: The base URL of the Management API.
118
-
-`credentials`: The credentials to use for the request.
119
-
-`token()`: A function that returns the current access token.
118
+
*`base`: The base URL of the Management API.
119
+
*`credentials`: The credentials to use for the request.
120
+
*`token()`: A function that returns the current access token.
120
121
121
122
Read more about this in the [UmbOpenApiConfiguration](https://apidocs.umbraco.com/v16/ui-api/interfaces/packages_core_auth.UmbOpenApiConfiguration.html) interface.
A repository must be instantiated in the context where it is used. It should take a host element as part of the constructor. This ensures that any contexts consumed in the repository, like notifications or modals, are rendered in the correct DOM context.
Copy file name to clipboardExpand all lines: 16/umbraco-cms/customizing/foundation/states.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,10 @@ description: >-
8
8
9
9
An Umbraco State is a container for a value, it enables you to create [Observables](states.md#observables), which is the name of a hook into the States value — An Observable can then be Observed, such observation provides the current value and if the value of the State changes they will all be updated accordingly.
10
10
11
-
A typical use case is when you need to implement reactivity across class instances. For example, a State is in a Context and the Observer is a Element. For a concrete example, see the [Extension Type Workspace Context](../../extending-overview/extension-types/workspaces/workspace-context.md) article.
11
+
A typical use case is when you need to implement reactivity across class instances. For example, a State is in a Context and the Observer is a Element. For a concrete example, see the [Extension Type Workspace Context](../extending-overview/extension-types/workspaces/workspace-context.md) article.
12
12
13
13
{% hint style="info" %}
14
-
Umbraco States are not relevant when dealing with the reactivity of a Web Component. For that, see the [Lit Element](../lit-element.md) article.
14
+
Umbraco States are not relevant when dealing with the reactivity of a Web Component. For that, see the [Lit Element](lit-element.md) article.
15
15
{% endhint %}
16
16
17
17
The example below demonstrates the basics of working with a State and observing its changes:
Copy file name to clipboardExpand all lines: 16/umbraco-cms/customizing/foundation/terminology.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,10 @@ description: A list of some of the key concepts with working the Umbraco Backoff
7
7
Understanding certain key concepts is essential when customizing the backoffice. These terminologies can help you decode the purpose of code effectively:
8
8
9
9
***Repository:** An API that enables communication with a server.
10
-
***State:** A reactive container holding data, when data is changed, all its Observables will be notified. You can read more about states and observables in the [States](working-with-data/states.md) article.
10
+
***State:** A reactive container holding data, when data is changed, all its Observables will be notified. You can read more about states and observables in the [States](states.md) article.
11
11
***Observable:** An observable is the hook for others to subscribe to the data of a State.
12
12
***Observe:** Observe describes what we do when subscribing to an Observable.
13
-
***Context-API:** The name used to serve APIs (instances/classes) for a certain context in the DOM. An API that is served via the Context-API is called a Context. You can read more about this in the [Context API](working-with-data/context-api.md) article.
13
+
***Context-API:** The name used to serve APIs (instances/classes) for a certain context in the DOM. An API that is served via the Context-API is called a Context. You can read more about this in the [Context API](context-api/) article.
14
14
***Context Provider:** Enables providing a class instance as a Context API.
15
15
***Context Consumer:** Enables the consumption of a Context API.
16
16
***Controller:** An abstract term for a thing that hooks into the lifecycle of an element. Many things in our system are Controllers.
0 commit comments