allatrona
12/17/2024, 11:00 AMKevin Jump
12/17/2024, 11:28 AMKevin Jump
12/17/2024, 11:28 AMallatrona
12/17/2024, 2:41 PMKevin Jump
12/17/2024, 2:47 PMKevin Jump
12/17/2024, 2:49 PMallatrona
12/17/2024, 2:54 PMKevin Jump
12/17/2024, 2:58 PMUMB_AUTH_CONTEXT
- but having something generate a client for you just removes the need for any browser request code etc.
e.g (this is assigning the token to a local OpenAPI client, - but you can just grab the token)
ts
_host.consumeContext(UMB_AUTH_CONTEXT, (_auth) => {
const umbOpenApi = _auth.getOpenApiConfiguration();
OpenAPI.TOKEN = umbOpenApi.token;
OpenAPI.BASE = umbOpenApi.base;
OpenAPI.WITH_CREDENTIALS = umbOpenApi.withCredentials;
});
I am not sure if there is something you can jump on in the umbraco core, because that too is generating a client library, for the requests to its own OpenAPI stuff,
everything can be wrapped in tryExecuteAndNotify calls, but that really is error handling the results not the actual requests.allatrona
12/17/2024, 3:00 PMKevin Jump
12/17/2024, 3:07 PMMyService.Method
call from any thing , controller, element, etc. (https://github.com/KevinJump/uSync/blob/v15/dev/uSync.Backoffice.Management.Client/usync-assets/src/repository/sources/SyncSettings.source.ts)
on the server side (if you don't have swagger stuff yet)
1. the key thing is configuring swagger for your stuff to appear (https://github.com/KevinJump/uSync/blob/v15/dev/uSync.Backoffice.Management.Api/Configuration/ConfigSyncApiSwaggerGenOptions.cs)
2. you probably want to mark up your methods/controllers with the backoffice attributes to restrict them (like here https://dev.to/kevinjump/early-adopters-guide-to-umbraco-v14-packages-communicating-with-the-server-part-1-38lb)allatrona
12/17/2024, 3:08 PMJacob Overgaard
12/17/2024, 4:12 PMJacob Overgaard
12/17/2024, 4:21 PMJacob Overgaard
12/17/2024, 4:29 PMdotnet new umbraco-extension
or check out its source: https://github.com/umbraco/Umbraco-CMS/blob/contrib/templates/UmbracoExtension/Client/src/entrypoints/entrypoint.ts#L14-L31allatrona
12/19/2024, 9:17 AM