Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
s8_ivanov_r
VPL-pizza-shop-blazor
Commits
1e86271f
Unverified
Commit
1e86271f
authored
May 30, 2020
by
Daniel Roth
Committed by
GitHub
May 30, 2020
Browse files
Update HttpClient registration to be scoped (#272)
parent
500f9edb
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
13 additions
and
13 deletions
+13
-13
docs/04-refactor-state-management.md
docs/04-refactor-state-management.md
+1
-1
docs/06-authentication-and-authorization.md
docs/06-authentication-and-authorization.md
+1
-1
save-points/00-get-started/BlazingPizza.Client/Program.cs
save-points/00-get-started/BlazingPizza.Client/Program.cs
+1
-1
save-points/01-Components-and-layout/BlazingPizza.Client/Program.cs
...s/01-Components-and-layout/BlazingPizza.Client/Program.cs
+1
-1
save-points/02-customize-a-pizza/BlazingPizza.Client/Program.cs
...oints/02-customize-a-pizza/BlazingPizza.Client/Program.cs
+1
-1
save-points/03-show-order-status/BlazingPizza.Client/Program.cs
...oints/03-show-order-status/BlazingPizza.Client/Program.cs
+1
-1
save-points/04-refactor-state-management/BlazingPizza.Client/Program.cs
...-refactor-state-management/BlazingPizza.Client/Program.cs
+1
-1
save-points/05-checkout-with-validation/BlazingPizza.Client/Program.cs
...5-checkout-with-validation/BlazingPizza.Client/Program.cs
+1
-1
save-points/06-authentication-and-authorization/BlazingPizza.Client/Program.cs
...tication-and-authorization/BlazingPizza.Client/Program.cs
+1
-1
save-points/07-javascript-interop/BlazingPizza.Client/Program.cs
...ints/07-javascript-interop/BlazingPizza.Client/Program.cs
+1
-1
save-points/08-templated-components/BlazingPizza.Client/Program.cs
...ts/08-templated-components/BlazingPizza.Client/Program.cs
+1
-1
save-points/09-progressive-web-app/BlazingPizza.Client/Program.cs
...nts/09-progressive-web-app/BlazingPizza.Client/Program.cs
+1
-1
src/BlazingPizza.Client/Program.cs
src/BlazingPizza.Client/Program.cs
+1
-1
No files found.
docs/04-refactor-state-management.md
View file @
1e86271f
...
...
@@ -20,7 +20,7 @@ public static async Task Main(string[] args)
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddScoped
<
OrderState
>();
await
builder
.
Build
().
RunAsync
();
...
...
docs/06-authentication-and-authorization.md
View file @
1e86271f
...
...
@@ -51,7 +51,7 @@ public static async Task Main(string[] args)
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddScoped
<
OrderState
>();
// Add auth services
...
...
save-points/00-get-started/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -13,7 +13,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
await
builder
.
Build
().
RunAsync
();
}
...
...
save-points/01-Components-and-layout/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -13,7 +13,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
await
builder
.
Build
().
RunAsync
();
}
...
...
save-points/02-customize-a-pizza/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -13,7 +13,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
await
builder
.
Build
().
RunAsync
();
}
...
...
save-points/03-show-order-status/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -13,7 +13,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
await
builder
.
Build
().
RunAsync
();
}
...
...
save-points/04-refactor-state-management/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -13,7 +13,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddScoped
<
OrderState
>();
await
builder
.
Build
().
RunAsync
();
...
...
save-points/05-checkout-with-validation/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -13,7 +13,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddScoped
<
OrderState
>();
await
builder
.
Build
().
RunAsync
();
...
...
save-points/06-authentication-and-authorization/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -14,7 +14,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddHttpClient
<
OrdersClient
>(
client
=>
client
.
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
))
.
AddHttpMessageHandler
<
BaseAddressAuthorizationMessageHandler
>();
builder
.
Services
.
AddScoped
<
OrderState
>();
...
...
save-points/07-javascript-interop/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -14,7 +14,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddHttpClient
<
OrdersClient
>(
client
=>
client
.
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
))
.
AddHttpMessageHandler
<
BaseAddressAuthorizationMessageHandler
>();
builder
.
Services
.
AddScoped
<
OrderState
>();
...
...
save-points/08-templated-components/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -14,7 +14,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddHttpClient
<
OrdersClient
>(
client
=>
client
.
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
))
.
AddHttpMessageHandler
<
BaseAddressAuthorizationMessageHandler
>();
builder
.
Services
.
AddScoped
<
OrderState
>();
...
...
save-points/09-progressive-web-app/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -14,7 +14,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddHttpClient
<
OrdersClient
>(
client
=>
client
.
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
))
.
AddHttpMessageHandler
<
BaseAddressAuthorizationMessageHandler
>();
builder
.
Services
.
AddScoped
<
OrderState
>();
...
...
src/BlazingPizza.Client/Program.cs
View file @
1e86271f
...
...
@@ -14,7 +14,7 @@ namespace BlazingPizza.Client
var
builder
=
WebAssemblyHostBuilder
.
CreateDefault
(
args
);
builder
.
RootComponents
.
Add
<
App
>(
"app"
);
builder
.
Services
.
Add
Transient
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
Add
Scoped
(
sp
=>
new
HttpClient
{
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
)
});
builder
.
Services
.
AddHttpClient
<
OrdersClient
>(
client
=>
client
.
BaseAddress
=
new
Uri
(
builder
.
HostEnvironment
.
BaseAddress
))
.
AddHttpMessageHandler
<
BaseAddressAuthorizationMessageHandler
>();
builder
.
Services
.
AddScoped
<
OrderState
>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment