Display profile now works

wrapping up #2
This commit is contained in:
2021-01-07 22:49:10 -05:00
parent ef12da01dc
commit 4f1c7b782a
18 changed files with 192 additions and 31 deletions

View File

@@ -33,6 +33,11 @@ namespace JobsJobsJobs.Client.Pages.Citizen
/// </summary>
private IEnumerable<Continent> Continents { get; set; } = Enumerable.Empty<Continent>();
/// <summary>
/// Whether this is a new profile or not
/// </summary>
private bool IsNew { get; set; } = false;
/// <summary>
/// Error messages from API access
/// </summary>
@@ -57,9 +62,15 @@ namespace JobsJobsJobs.Client.Pages.Citizen
if (profileTask.Result.IsOk)
{
ProfileForm = (profileTask.Result.Ok == null)
? new ProfileForm()
: ProfileForm.FromProfile(profileTask.Result.Ok);
if (profileTask.Result.Ok == null)
{
ProfileForm = new ProfileForm();
IsNew = true;
}
else
{
ProfileForm = ProfileForm.FromProfile(profileTask.Result.Ok);
}
if (ProfileForm.Skills.Count == 0) AddNewSkill();
}
else
@@ -98,6 +109,7 @@ namespace JobsJobsJobs.Client.Pages.Citizen
if (res.IsSuccessStatusCode)
{
toast.ShowSuccess("Profile Saved Successfully");
nav.NavigateTo($"/profile/view/{state.User!.Id}");
}
else
{