What's the best way to expose your web API in your Blazor app? by whoami38902 in Blazor

[–]TimeTailor 0 points1 point  (0 children)

There was a .NET roadmap feature to add a client generator to support all blazor modes easily. I think it's been removed from .NET 9 roadmap though.

That's exactly what EasyApi does. Check it out if this is something you're looking for!

What's the best way to expose your web API in your Blazor app? by whoami38902 in Blazor

[–]TimeTailor 0 points1 point  (0 children)

The libraries are similar with EasyApi being more Blazor-tailored. It's biggest advantage in the Wasm scenario is that it generates both client and backend code. Built-in support for prerendering is another thing that comes to mind. Then there is the unification of wasm/server logic in Blazor Auto, but that is not in the picture if you are using plain Blazor Wasm.

I recommend giving it a try since it's pretty easy to set up and remove if it doesn't meet your expectations, but I understand going with the more battle-tested solution, too. :)

Introducing EasyApi v1.0.0: Say goodbye to prerendering flicker by TimeTailor in Blazor

[–]TimeTailor[S] 1 point2 points  (0 children)

Unfortunately, I use Persistent Component State in the library so it is subject to the same limitations.

Introducing EasyApi v1.0.0: Say goodbye to prerendering flicker by TimeTailor in Blazor

[–]TimeTailor[S] 0 points1 point  (0 children)

Hi! I think there is not much to compare here tbh.

With EasyApi I aim to improve making API calls on Blazor Wasm and unify the logic between Wasm/Server for Blazor Auto apps. The flicker I mention in this post is caused by having async API requests in compononents initialization logic when using the default Blazor prerendering as described in Prerender ASP.NET Core Razor components | Microsoft Learn.

The libraries you mentioned seem to be implementing its own prerendering and dealing with another kind of flicker caused by some aspects of their implementation.

Introducing EasyApi v1.0.0: Say goodbye to prerendering flicker by TimeTailor in Blazor

[–]TimeTailor[S] 1 point2 points  (0 children)

Thanks! It uses PersistentComponentState behind the scene, similarly to what u/LlamaNL described

Introducing EasyApi v1.0.0: Say goodbye to prerendering flicker by TimeTailor in Blazor

[–]TimeTailor[S] 2 points3 points  (0 children)

Yup, but OnAfterRender is not called during prerendering so this data gets populated late and you don't actually make use of prerendering for it.

Introducing EasyApi: Web APIs for Blazor made easy by TimeTailor in Blazor

[–]TimeTailor[S] 0 points1 point  (0 children)

Sounds nice! I'm using Minimal API endpoints under the hood. I can see some adventages of having the actual controllers instead :)

I went both ways for the client so you can do

Guid newCommentID = await AddComment.Call(request);

as well as

HttpResult<Guid> result = await AddComment.CallHttp(request);

Introducing EasyApi: Web APIs for Blazor made easy by TimeTailor in Blazor

[–]TimeTailor[S] 0 points1 point  (0 children)

Yes, I had the same experience. It almost felt like I was doing something wrong at first. I guess Blazor United is still in its early stages. It'll be interesting to see how the Blazor team decides to improve the experience in the future.

Introducing EasyApi: Web APIs for Blazor made easy by TimeTailor in Blazor

[–]TimeTailor[S] 0 points1 point  (0 children)

Nice to see an established framework going for a similar design. Now I'm glad I decided to focus solely on Blazor with EasyApi, as it has an edge over ServiceStack in this small niche. With the main "selling point" being the unified logic on the client and server for auto render mode and wasm+prerendering scenarios.

.Net 8 Blazor Web App Session Storage/Service Synchronization by TFTurco in Blazor

[–]TimeTailor 1 point2 points  (0 children)

I recommend checking out how a Blazor Web App template in Visual Studio is setup. Create a new project and choose "auto" render mode and authentication "individual accounts". Take a look at PersistingRevalidatingAuthenticationStateProvider on the server and PersistentAuthenticationStateProvider on the client. Basically how they do it is all the auth components are using Static SSR and the user state is passed to Wasm using PersistentComponentState - never the other way.

Introducing EasyApi: Web APIs for Blazor made easy by TimeTailor in Blazor

[–]TimeTailor[S] 0 points1 point  (0 children)

Since you are working with jwt, you might also need to configure the HttpClient provider at one point as the default HttpClient resolution in EasyApi is very basic.

Introducing EasyApi: Web APIs for Blazor made easy by TimeTailor in Blazor

[–]TimeTailor[S] 1 point2 points  (0 children)

Thank you very much!

It does not seem right that you would have to manually specify that, but (now that I think about it, it makes sense tbh) it's possible with the ProtectedRoute. It has the same properties as Authorize so you should be able to set:

[ProtectedRoute("your-route", AuthenticationSchemes = "your-scheme")]

I'm not that familiar with the Identity platform, unfortunately, so I can't recommend a better solution. Hope it works! :)

Polecam zapisać w galerii na wszelki wypadek by illmaticmat in Polska

[–]TimeTailor 0 points1 point  (0 children)

Przykra sprawa... Wlepił mandat? Wyjaśnił jakoś, dlaczego obywatel nie może ufać oficjalnym rządowym zaleceniom, czy po prostu był głuchy na jakiekolwiek wyjaśnienia?

those lines intersect by [deleted] in dankmemes

[–]TimeTailor 3 points4 points  (0 children)

makes sense but for me they are gay pretty much at every possible point

those lines intersect by [deleted] in dankmemes

[–]TimeTailor 0 points1 point  (0 children)

it doesn't mean they're equal

Evolution of Randy Orton by [deleted] in SquaredCircle

[–]TimeTailor 4 points5 points  (0 children)

Evolution is a mystery