mirror of
https://github.com/Shchoholiev/shopping-assistant-web-client.git
synced 2025-04-12 01:48:49 +00:00
SA-142 login loop fixed
This commit is contained in:
parent
7493d3906b
commit
c5edc8df79
@ -15,7 +15,7 @@ public static class DependencyInjectionExtension
|
||||
client.BaseAddress = new Uri(apiUrl + "api/");
|
||||
});
|
||||
|
||||
services.AddScoped<GraphQLHttpClient>(p =>
|
||||
services.AddSingleton<GraphQLHttpClient>(p =>
|
||||
new GraphQLHttpClient(apiUrl + "graphql", new NewtonsoftJsonSerializer())
|
||||
);
|
||||
|
||||
|
@ -14,6 +14,8 @@ public class GlobalUserMiddleware
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext httpContext, AuthenticationService authenticationService, ApiClient apiClient)
|
||||
{
|
||||
if (httpContext.Request.Path != "/login")
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -32,6 +34,7 @@ public class GlobalUserMiddleware
|
||||
httpContext.Response.Cookies.Delete("accessToken");
|
||||
httpContext.Response.Redirect("/login");
|
||||
}
|
||||
}
|
||||
await _next(httpContext);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user