diff --git a/src/JobsJobsJobs/App/src/App.vue b/src/JobsJobsJobs/App/src/App.vue index d5f4406..699f5c5 100644 --- a/src/JobsJobsJobs/App/src/App.vue +++ b/src/JobsJobsJobs/App/src/App.vue @@ -30,7 +30,7 @@ export default defineComponent({ AppNav, TitleBar }, - data () { + setup () { return { // } diff --git a/src/JobsJobsJobs/App/src/api/index.ts b/src/JobsJobsJobs/App/src/api/index.ts new file mode 100644 index 0000000..e81ce88 --- /dev/null +++ b/src/JobsJobsJobs/App/src/api/index.ts @@ -0,0 +1,25 @@ +import { LogOnSuccess } from './types' + +/** + * Create a URL that will access the API + * @param url The partial URL for the API + * @returns A full URL for the API + */ +const apiUrl = (url : string) : string => `/api/${url}` + +export default { + + /** + * Log a citizen on + * @param code The authorization code from No Agenda Social + * @returns The user result, or an error + */ + logOn: async (code : string) : Promise => { + const resp = await fetch(apiUrl(`/citizen/log-on/${code}`), { method: 'GET' }) + if (resp.status === 200) return await resp.json() as LogOnSuccess + console.error(await resp.text()) + return 'Error logging on' + } +} + +export * from './types' diff --git a/src/JobsJobsJobs/App/src/api/types.ts b/src/JobsJobsJobs/App/src/api/types.ts new file mode 100644 index 0000000..34bfb0e --- /dev/null +++ b/src/JobsJobsJobs/App/src/api/types.ts @@ -0,0 +1,10 @@ + +/** A successful logon */ +export interface LogOnSuccess { + /** The JSON Web Token (JWT) to use for API access */ + jwt : string + /** The ID of the logged-in citizen (as a string) */ + citizenId : string + /** The name of the logged-in citizen */ + name : string +} diff --git a/src/JobsJobsJobs/App/src/components/shared/AppFooter.vue b/src/JobsJobsJobs/App/src/components/shared/AppFooter.vue index a6cd928..92a4bae 100644 --- a/src/JobsJobsJobs/App/src/components/shared/AppFooter.vue +++ b/src/JobsJobsJobs/App/src/components/shared/AppFooter.vue @@ -4,20 +4,6 @@

- -