diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor b/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
index 82e4609..ebf5eee 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
@@ -3,34 +3,4 @@
@inject NavigationManager nav
@inject AppState state
-
@message
-
-@code {
- string message = "Logging you on with No Agenda Social...";
-
- protected override async Task OnInitializedAsync()
- {
- // Exchange authorization code for a JWT
- var query = QueryHelpers.ParseQuery(nav.ToAbsoluteUri(nav.Uri).Query);
- if (query.TryGetValue("code", out var authCode))
- {
- var logOnResult = await ServerApi.LogOn(http, authCode);
-
- if (logOnResult.IsOk)
- {
- var logOn = logOnResult.Ok;
- state.User = new UserInfo(logOn.CitizenId, logOn.Name);
- state.Jwt = logOn.Jwt;
- nav.NavigateTo("/citizen/dashboard");
- }
- else
- {
- message = logOnResult.Error;
- }
- }
- else
- {
- message = "Did not receive a token from No Agenda Social (perhaps you clicked \"Cancel\"?)";
- }
- }
-}
+@Message
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor.cs b/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor.cs
new file mode 100644
index 0000000..06d6c2c
--- /dev/null
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor.cs
@@ -0,0 +1,40 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.WebUtilities;
+using System.Threading.Tasks;
+
+namespace JobsJobsJobs.Client.Pages.Citizen
+{
+ public partial class Authorized : ComponentBase
+ {
+ ///
+ /// The message to be displayed on this page
+ ///
+ private string Message { get; set; } = "Logging you on with No Agenda Social...";
+
+ protected override async Task OnInitializedAsync()
+ {
+ // Exchange authorization code for a JWT
+ var query = QueryHelpers.ParseQuery(nav.ToAbsoluteUri(nav.Uri).Query);
+ if (query.TryGetValue("code", out var authCode))
+ {
+ var logOnResult = await ServerApi.LogOn(http, authCode);
+
+ if (logOnResult.IsOk)
+ {
+ var logOn = logOnResult.Ok;
+ state.User = new UserInfo(logOn.CitizenId, logOn.Name);
+ state.Jwt = logOn.Jwt;
+ nav.NavigateTo("/citizen/dashboard");
+ }
+ else
+ {
+ Message = logOnResult.Error;
+ }
+ }
+ else
+ {
+ Message = "Did not receive a token from No Agenda Social (perhaps you clicked \"Cancel\"?)";
+ }
+ }
+ }
+}
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
index 59e4a78..ecf4dc1 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
@@ -1,6 +1,8 @@
@page "/citizen/dashboard"
+@inject HttpClient http
+@inject AppState state
-Welcome, @State.User!.Name!
+Welcome, @state.User!.Name!
@if (RetrievingData)
{
@@ -8,34 +10,25 @@
}
else
{
- if (Profile != null)
- {
+
+ @if (Profile != null)
+ {
+
+ Your employment profile was last updated . Your profile currently
+ lists @Profile.Skills.Length skill@(Profile.Skills.Length != 1 ? "s" : "").
+
+ }
+ else
+ {
+ You do not have an employment profile established; click “Profile”* in the menu to get started!
+ }
- Your employment profile was last updated . Your profile currently
- lists @SkillCount skill@(SkillCount != 1 ? "s" : "").
+ There @(ProfileCount == 1 ? "is" : "are") @(ProfileCount == 0 ? "no" : ProfileCount) employment
+ profile@(ProfileCount != 1 ? "s" : "") from citizens of Gitmo Nation.
+ @if (ProfileCount > 0)
+ {
+ Take a look around and see if you can help them find work!
+ }
- }
- else
- {
- You do not have an employment profile established; click “Profile”* in the menu to get started!
- }
-
- There @(ProfileCount == 1 ? "is" : "are") @(ProfileCount == 0 ? "no" : ProfileCount) employment
- profile@(ProfileCount != 1 ? "s" : "") from citizens of Gitmo Nation.
- @if (ProfileCount > 0)
- {
- Take a look around and see if you can help them find work!
- }
-
-}
-
-@if (ErrorMessages.Count > 0)
-{
- The following error(s) occurred:
-
- @foreach (var msg in ErrorMessages)
- {
- @msg
- }
-
+
}
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor.cs b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor.cs
index 79ba0cc..71dccac 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor.cs
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor.cs
@@ -1,9 +1,8 @@
-using JobsJobsJobs.Shared;
-using JobsJobsJobs.Shared.Api;
+using JobsJobsJobs.Shared.Api;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
-using System.Net.Http;
using System.Threading.Tasks;
+using Domain = JobsJobsJobs.Shared;
namespace JobsJobsJobs.Client.Pages.Citizen
{
@@ -20,46 +19,27 @@ namespace JobsJobsJobs.Client.Pages.Citizen
///
/// The user's profile
///
- private Profile? Profile { get; set; } = null;
-
- ///
- /// The number of skills in the user's profile
- ///
- private long SkillCount { get; set; } = 0L;
+ private Domain.Profile? Profile { get; set; } = null;
///
/// The number of profiles
///
- private long ProfileCount { get; set; } = 0L;
+ private int ProfileCount { get; set; }
///
/// Error messages from data access
///
private IList ErrorMessages { get; } = new List();
- ///
- /// The HTTP client to use for API access
- ///
- [Inject]
- public HttpClient Http { get; set; } = default!;
-
- ///
- /// The current application state
- ///
- [Inject]
- public AppState State { get; set; } = default!;
-
-
protected override async Task OnInitializedAsync()
{
- if (State.User != null)
+ if (state.User != null)
{
- ServerApi.SetJwt(Http, State);
- var profileTask = ServerApi.RetrieveProfile(Http, State);
- var profileCountTask = ServerApi.RetrieveOne(Http, "profile/count");
- var skillCountTask = ServerApi.RetrieveOne(Http, "profile/skill-count");
+ ServerApi.SetJwt(http, state);
+ var profileTask = ServerApi.RetrieveProfile(http, state);
+ var profileCountTask = ServerApi.RetrieveOne(http, "profile/count");
- await Task.WhenAll(profileTask, profileCountTask, skillCountTask);
+ await Task.WhenAll(profileTask, profileCountTask);
if (profileTask.Result.IsOk)
{
@@ -79,18 +59,8 @@ namespace JobsJobsJobs.Client.Pages.Citizen
ErrorMessages.Add(profileCountTask.Result.Error);
}
- if (skillCountTask.Result.IsOk)
- {
- SkillCount = skillCountTask.Result.Ok?.Value ?? 0;
- }
- else
- {
- ErrorMessages.Add(skillCountTask.Result.Error);
- }
-
RetrievingData = false;
}
}
-
}
}
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
index ac2d451..e652248 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
@@ -1,4 +1,7 @@
@page "/citizen/profile"
+@inject HttpClient http
+@inject AppState state
+@inject IToastService toast
Employment Profile
@@ -14,12 +17,12 @@
}
else
{
-
+
@@ -51,21 +54,21 @@
Professional Biography
-
-
+
+ ProfileForm.Biography) />