Skip to content

Commit

Permalink
Added a hack to make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Jul 15, 2023
1 parent 31b28b3 commit b8ffb08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Todo.Web/Client/TodoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public async Task<bool> DeleteTodoAsync(int id)

public async Task<(HttpStatusCode, List<TodoItem>?)> 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<TodoItem>? todos = null;
Expand Down

0 comments on commit b8ffb08

Please sign in to comment.