Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
stijuh committed May 21, 2023
1 parent 09c4e2a commit d5ea173
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GainsTracker.ClientNative/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static MauiApp CreateMauiApp()
builder.Services.AddScoped<IGainsAuthService, GainsAuthService>();
builder.Services.AddScoped<IGainsTrackerService, GainsTrackerService>();
builder.Services.AddSingleton<HttpClient>();

return builder.Build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public FriendRequest(GainsAccount requestedBy, GainsAccount requestedTo)
public void Accept()
{
Status = FriendRequestStatus.Accepted;

//TODO: Maybe sent an event or something for notifications?
RequestedBy.SentFriendRequests.Remove(this);
RequestedTo.ReceivedFriendRequests.Remove(this);
Expand All @@ -47,6 +48,7 @@ public void Accept()
public void Reject()
{
Status = FriendRequestStatus.Rejected;

// No event, happens silently.
RequestedBy.SentFriendRequests.Remove(this);
RequestedTo.ReceivedFriendRequests.Remove(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public Workout GetWorkoutWithMeasurementsById(string id)
public void UpdateDisplayNameByUserHandle(string userHandle, string newDisplayName)
{
GainsAccount? gains = Context.GainsAccounts.FirstOrDefault(g => g.UserHandle.ToLower() == userHandle.ToLower());

//TODO: filter out bad words n shizzle
gains.DisplayName = newDisplayName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static void ConfigureAuthentication(this WebApplicationBuilder builder)
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})

// Add the JWT Bearer.
.AddJwtBearer(options =>
{
Expand Down
2 changes: 2 additions & 0 deletions GainsTracker.UI/Services/GainsAuthService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ public async Task<bool> SignUp(string email, string password)
{ "password", password },
{ "firstName", "Standard" },
{ "lastName", "User" }

//TODO: Expand with actual name and other info of the user.
};

StringContent content = new(loginDto.ToString(), Encoding.UTF8, "application/json");
HttpResponseMessage response = await _httpClient.PostAsync(url, content);

ValidateResponse(response);

//TODO: This response contains the JWT. implement the setting authorization of the returned token here.

return response.IsSuccessStatusCode;
Expand Down
1 change: 0 additions & 1 deletion GainsTracker.UI/Shared/SurveyPrompt.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
[Parameter]
public string Title { get; set; }
}

0 comments on commit d5ea173

Please sign in to comment.