Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion templates/UmbracoExtension/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@
{
"condition": "(!IncludeExample)",
"exclude": [
"[Cc]lient/src/dashboards/**"
"[Cc]lient/src/dashboards/**",
"ViewModels/**"
]
},
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions templates/UmbracoExtension/Client/src/api/client/utils.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions templates/UmbracoExtension/Client/src/api/index.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions templates/UmbracoExtension/Client/src/api/sdk.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 27 additions & 84 deletions templates/UmbracoExtension/Client/src/api/types.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { UmbElementMixin } from "@umbraco-cms/backoffice/element-api";
import { UUIButtonElement } from "@umbraco-cms/backoffice/external/uui";
import { UMB_NOTIFICATION_CONTEXT } from "@umbraco-cms/backoffice/notification";
import { UMB_CURRENT_USER_CONTEXT, UmbCurrentUserModel } from "@umbraco-cms/backoffice/current-user";
import { whoAmI, whatsTheTimeMrWolf, whatsMyName, Iuser } from "../api/index.js";
import { getWhoAmI, getWhatsTheTimeMrWolf, getWhatsMyName, WhoAmIResponseModel } from "../api/index.js";

@customElement("example-dashboard")
export class ExampleDashboardElement extends UmbElementMixin(LitElement) {
Expand All @@ -20,7 +20,7 @@ export class ExampleDashboardElement extends UmbElementMixin(LitElement) {
private _timeFromMrWolf?: Date;

@state()
private _serverUserData?: Iuser;
private _serverUserData?: WhoAmIResponseModel;

@state()
private _contextCurrentUser?: UmbCurrentUserModel;
Expand Down Expand Up @@ -52,16 +52,16 @@ export class ExampleDashboardElement extends UmbElementMixin(LitElement) {
const buttonElement = ev.target as UUIButtonElement;
buttonElement.state = "waiting";

const { data, error } = await whoAmI();
const { data, error } = await getWhoAmI();

if (error) {
buttonElement.state = "failed";
console.error(error);
return;
}

if (data !== undefined) {
this._serverUserData = data as Iuser;
if (data?.email) {
this._serverUserData = data;
buttonElement.state = "success";
}

Comment thread
lauraneto marked this conversation as resolved.
Outdated
Expand All @@ -80,7 +80,7 @@ export class ExampleDashboardElement extends UmbElementMixin(LitElement) {
buttonElement.state = "waiting";

// Getting a string - should I expect a datetime?!
const { data, error } = await whatsTheTimeMrWolf();
const { data, error } = await getWhatsTheTimeMrWolf();

if (error) {
buttonElement.state = "failed";
Expand All @@ -98,7 +98,7 @@ export class ExampleDashboardElement extends UmbElementMixin(LitElement) {
const buttonElement = ev.target as UUIButtonElement;
buttonElement.state = "waiting";

const { data, error } = await whatsMyName();
const { data, error } = await getWhatsMyName();

if (error) {
buttonElement.state = "failed";
Expand All @@ -120,8 +120,8 @@ export class ExampleDashboardElement extends UmbElementMixin(LitElement) {
: "Press the button!"}
</h2>
<ul>
${this._serverUserData?.groups.map(
(group) => html`<li>${group.name}</li>`
${this._serverUserData?.groups?.map(
(group) => html`<li>${group}</li>`
)}
</ul>
<uui-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public void Compose(IUmbracoBuilder builder) =>
document => document
.WithTitle("Umbraco Extension Backoffice API")
.WithBackOfficeAuthentication()
.WithJsonOptions(Umbraco.Cms.Core.Constants.JsonOptionsNames.BackOffice)
.ConfigureOpenApiOptions(options =>
options.AddDocumentTransformer((doc, _, _) =>
{
Expand Down
Loading
Loading