Skip to content

Commit

Permalink
Update web app by separating client sdk (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo authored Apr 23, 2024
1 parent 2f68347 commit 9da46d2
Show file tree
Hide file tree
Showing 33 changed files with 29 additions and 2,350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public static IServiceCollection AddPetStoreClient(this IServiceCollection servi
services.AddScoped<PetStoreClient>(p =>
{
var httpClient = p.GetService<HttpClient>();
httpClient.BaseAddress = new Uri("https://petstore3.swagger.io/api/v3");
var provider = new AnonymousAuthenticationProvider();
var adapter = new HttpClientRequestAdapter(provider, httpClient: httpClient);
adapter.BaseUrl = "https://petstore3.swagger.io/api/v3";
var adapter = new HttpClientRequestAdapter(provider, httpClient: httpClient)
{
BaseUrl = "https://petstore3.swagger.io/api/v3"
};
var client = new PetStoreClient(adapter);
return client;
Expand Down
10 changes: 10 additions & 0 deletions dotnet/src/WebApp.Extensions/Pages/Home.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@page "/"
@using WebApp.UI

<PageTitle>Home</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.

<AvailablePetsComponent />
15 changes: 15 additions & 0 deletions dotnet/src/WebApp.Extensions/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;

using WebApp;
using WebApp.Extensions;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

builder.Services.AddPetStoreClient();

await builder.Build().RunAsync();
73 changes: 0 additions & 73 deletions dotnet/src/WebApp/ApiClients/Models/ApiResponse.cs

This file was deleted.

63 changes: 0 additions & 63 deletions dotnet/src/WebApp/ApiClients/Models/Category.cs

This file was deleted.

73 changes: 0 additions & 73 deletions dotnet/src/WebApp/ApiClients/Models/Order.cs

This file was deleted.

15 changes: 0 additions & 15 deletions dotnet/src/WebApp/ApiClients/Models/Order_status.cs

This file was deleted.

97 changes: 0 additions & 97 deletions dotnet/src/WebApp/ApiClients/Models/Pet.cs

This file was deleted.

15 changes: 0 additions & 15 deletions dotnet/src/WebApp/ApiClients/Models/Pet_status.cs

This file was deleted.

Loading

0 comments on commit 9da46d2

Please sign in to comment.