...
This commit is contained in:
@@ -17,9 +17,9 @@ public class CardNotesGraphQLService
|
||||
_http = http;
|
||||
_networkStatus = networkStatus;
|
||||
_authService = authService;
|
||||
_graphqlEndpoint = http.BaseAddress != null && http.BaseAddress.Port == 5256
|
||||
_graphqlEndpoint = http.BaseAddress != null && http.BaseAddress.Port == 7266
|
||||
? "/graphql"
|
||||
: "http://localhost:5256/graphql";
|
||||
: "https://localhost:7266/graphql";
|
||||
}
|
||||
|
||||
public async Task<bool> IsApiOnlineAsync()
|
||||
@@ -123,9 +123,12 @@ public class CardNotesGraphQLService
|
||||
if (httpResponse.IsSuccessStatusCode)
|
||||
return await httpResponse.Content.ReadFromJsonAsync<GraphQLResponse<T>>();
|
||||
|
||||
if (_graphqlEndpoint == "/graphql")
|
||||
if (_graphqlEndpoint == "/graphql" || _graphqlEndpoint.StartsWith("https://"))
|
||||
{
|
||||
var fallbackResponse = await SendToUrlAsync("http://localhost:5256/graphql");
|
||||
var fallbackUrl = _graphqlEndpoint == "/graphql"
|
||||
? "https://localhost:7266/graphql"
|
||||
: "http://localhost:7266/graphql";
|
||||
var fallbackResponse = await SendToUrlAsync(fallbackUrl);
|
||||
if (fallbackResponse.IsSuccessStatusCode)
|
||||
return await fallbackResponse.Content.ReadFromJsonAsync<GraphQLResponse<T>>();
|
||||
}
|
||||
@@ -134,12 +137,27 @@ public class CardNotesGraphQLService
|
||||
{
|
||||
try
|
||||
{
|
||||
var fallbackResponse = await SendToUrlAsync("http://localhost:5256/graphql");
|
||||
var fallbackUrl = _graphqlEndpoint.StartsWith("http://")
|
||||
? "https://localhost:7266/graphql"
|
||||
: "http://localhost:7266/graphql";
|
||||
var fallbackResponse = await SendToUrlAsync(fallbackUrl);
|
||||
if (fallbackResponse.IsSuccessStatusCode)
|
||||
return await fallbackResponse.Content.ReadFromJsonAsync<GraphQLResponse<T>>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (_graphqlEndpoint == "/graphql")
|
||||
{
|
||||
try
|
||||
{
|
||||
var fallbackHttp = await SendToUrlAsync("http://localhost:7266/graphql");
|
||||
if (fallbackHttp.IsSuccessStatusCode)
|
||||
return await fallbackHttp.Content.ReadFromJsonAsync<GraphQLResponse<T>>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user