From b8ffb08fb0416f7c1de3f40f62911009b81b644f Mon Sep 17 00:00:00 2001 From: David Fowler Date: Fri, 14 Jul 2023 22:21:15 -0400 Subject: [PATCH] Added a hack to make it work --- Todo.Web/Client/TodoClient.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Todo.Web/Client/TodoClient.cs b/Todo.Web/Client/TodoClient.cs index 28b84ff6..386d0276 100644 --- a/Todo.Web/Client/TodoClient.cs +++ b/Todo.Web/Client/TodoClient.cs @@ -32,6 +32,12 @@ public async Task DeleteTodoAsync(int id) public async Task<(HttpStatusCode, List?)> GetTodosAsync() { + // This is a hack from hell to avoid having to know if this is running server or client side + if (client.BaseAddress is null) + { + return (HttpStatusCode.OK, new()); + } + var response = await client.GetAsync("todos"); var statusCode = response.StatusCode; List? todos = null;