move some lines around
This commit is contained in:
parent
432e0939b1
commit
112088a6ab
@ -25,16 +25,15 @@ var host = Host.CreateDefaultBuilder(args)
|
|||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var configuration = host.Services.GetService<IConfiguration>();
|
var configuration = host.Services.GetService<IConfiguration>();
|
||||||
|
var userRoutes = host.Services.GetService<IOptions<List<User>>>();
|
||||||
var httpClientFactory = host.Services.GetService<IHttpClientFactory>();
|
var httpClientFactory = host.Services.GetService<IHttpClientFactory>();
|
||||||
|
|
||||||
var httpClient = httpClientFactory.CreateClient();
|
var httpClient = httpClientFactory.CreateClient();
|
||||||
|
|
||||||
var apiBaseUrl = configuration["Urls:Api"];
|
var apiBaseUrl = configuration["Urls:Api"];
|
||||||
var apiBusRouteUrl = UrlUtility.Combine(apiBaseUrl, "api/routes");
|
var apiBusRouteUrl = UrlUtility.Combine(apiBaseUrl, "api/routes");
|
||||||
var busRoutesRaw = await httpClient.GetStringAsync(apiBusRouteUrl);
|
var busRoutesRaw = await httpClient.GetStringAsync(apiBusRouteUrl);
|
||||||
|
|
||||||
var userRoutes = host.Services.GetService<IOptions<List<User>>>();
|
|
||||||
|
|
||||||
var busRoutes = JsonConvert.DeserializeObject<ICollection<BusRoute>>(busRoutesRaw);
|
var busRoutes = JsonConvert.DeserializeObject<ICollection<BusRoute>>(busRoutesRaw);
|
||||||
|
|
||||||
foreach (var userRoute in userRoutes.Value)
|
foreach (var userRoute in userRoutes.Value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user