diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 37fc584..429547e 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fake-cli": { - "version": "5.22.0", + "version": "5.23.0", "commands": [ "fake" ] diff --git a/src/JobsJobsJobs/App/package-lock.json b/src/JobsJobsJobs/App/package-lock.json index a89b7e7..edf87a0 100644 --- a/src/JobsJobsJobs/App/package-lock.json +++ b/src/JobsJobsJobs/App/package-lock.json @@ -1,12 +1,12 @@ { "name": "jobs-jobs-jobs", - "version": "2.2.2", + "version": "3.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jobs-jobs-jobs", - "version": "2.2.2", + "version": "3.0.0", "dependencies": { "@mdi/js": "^6.9.96", "@vuelidate/core": "^2.0.0-alpha.24", diff --git a/src/JobsJobsJobs/App/package.json b/src/JobsJobsJobs/App/package.json index eb1b254..8b74d8c 100644 --- a/src/JobsJobsJobs/App/package.json +++ b/src/JobsJobsJobs/App/package.json @@ -1,6 +1,6 @@ { "name": "jobs-jobs-jobs", - "version": "2.2.2", + "version": "3.0.0", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/JobsJobsJobs/App/src/api/index.ts b/src/JobsJobsJobs/App/src/api/index.ts index 48ba69d..f63ad6b 100644 --- a/src/JobsJobsJobs/App/src/api/index.ts +++ b/src/JobsJobsJobs/App/src/api/index.ts @@ -1,5 +1,6 @@ import { Citizen, + CitizenRegistrationForm, Continent, Count, Instance, @@ -33,12 +34,14 @@ const apiUrl = (url : string) : string => `/api/${url}` * * @param method The method by which the request should be executed * @param user The currently logged-on user + * @param body The body of teh request * @returns RequestInit parameters */ // eslint-disable-next-line -const reqInit = (method : string, user : LogOnSuccess, body : any | undefined = undefined) : RequestInit => { +const reqInit = (method : string, user : LogOnSuccess | undefined, body : any | undefined = undefined) + : RequestInit => { const headers = new Headers() - headers.append("Authorization", `Bearer ${user.jwt}`) + if (user) headers.append("Authorization", `Bearer ${user.jwt}`) if (body) { headers.append("Content-Type", "application/json") return { @@ -98,6 +101,15 @@ export default { /** API functions for citizens */ citizen: { + /** + * Register a citizen + * + * @param form The registration details for the citizen + * @returns True if the registration was successful, an error message if it was not + */ + register: async (form : CitizenRegistrationForm) : Promise => + apiSend(await fetch(apiUrl("citizen/register"), reqInit("POST", undefined, form)), "registering citizen"), + /** * Log a citizen on * @@ -172,12 +184,12 @@ export default { * Expire a job listing * * @param id The ID of the job listing to be expired - * @param form The information needed to expire the form + * @param form The information needed to expire the listing * @param user The currently logged-on user * @returns True if the action was successful, an error string if not */ - expire: async (id : string, listing : ListingExpireForm, user : LogOnSuccess) : Promise => - apiSend(await fetch(apiUrl(`listing/${id}`), reqInit("PATCH", user, listing)), "expiring job listing"), + expire: async (id : string, form : ListingExpireForm, user : LogOnSuccess) : Promise => + apiSend(await fetch(apiUrl(`listing/${id}`), reqInit("PATCH", user, form)), "expiring job listing"), /** * Retrieve the job listings posted by the current citizen diff --git a/src/JobsJobsJobs/App/src/router/index.ts b/src/JobsJobsJobs/App/src/router/index.ts index e934cee..2a09773 100644 --- a/src/JobsJobsJobs/App/src/router/index.ts +++ b/src/JobsJobsJobs/App/src/router/index.ts @@ -50,6 +50,18 @@ const routes: Array = [ meta: { title: "Terms of Service" } }, // Citizen URLs + { + path: "/citizen/register", + name: "CitizenRegistration", + component: () => import(/* webpackChunkName: "register" */ "../views/citizen/Register.vue"), + meta: { title: "Register" } + }, + { + path: "/citizen/registered", + name: "CitizenRegistered", + component: () => import(/* webpackChunkName: "register" */ "../views/citizen/Registered.vue"), + meta: { title: "Registration Successful" } + }, { path: "/citizen/log-on", name: "LogOn", diff --git a/src/JobsJobsJobs/App/src/views/citizen/Register.vue b/src/JobsJobsJobs/App/src/views/citizen/Register.vue index fbbdcab..241e86f 100644 --- a/src/JobsJobsJobs/App/src/views/citizen/Register.vue +++ b/src/JobsJobsJobs/App/src/views/citizen/Register.vue @@ -1,22 +1,22 @@ -