From daece3eab1b248fa61f332a6365e6606f9777e7c Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 23 Nov 2020 21:33:37 -0500 Subject: [PATCH] Tweaks to login flow (#1) --- src/jobs-jobs-jobs/src/auth/index.ts | 8 +++----- src/jobs-jobs-jobs/src/router/index.ts | 6 ++++++ .../src/views/user/Authorized.vue | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/jobs-jobs-jobs/src/auth/index.ts b/src/jobs-jobs-jobs/src/auth/index.ts index 8ae95de..ab6cca0 100644 --- a/src/jobs-jobs-jobs/src/auth/index.ts +++ b/src/jobs-jobs-jobs/src/auth/index.ts @@ -40,7 +40,7 @@ export function authorize() { * * @param authCode The authorization code obtained from No Agenda Social */ -export async function logOn(authCode: string) { +export async function logOn(authCode: string): Promise { try { const resp = await doRequest(`${NAS_URL}oauth/token`, 'POST', JSON.stringify({ @@ -54,10 +54,8 @@ export async function logOn(authCode: string) { ) const token = await resp.json() await jjjAuthorize(token.access_token) - // TODO: navigate to user welcome page - console.info(`Success - response ${JSON.stringify(token)}`) + return '' } catch (e) { - // TODO: notify the user - console.error(`Failure - ${e}`) + return `${e}` } } diff --git a/src/jobs-jobs-jobs/src/router/index.ts b/src/jobs-jobs-jobs/src/router/index.ts index 8e12de1..eac5610 100644 --- a/src/jobs-jobs-jobs/src/router/index.ts +++ b/src/jobs-jobs-jobs/src/router/index.ts @@ -1,6 +1,7 @@ import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' import Home from '../views/Home.vue' +import Welcome from '../views/citizen/Welcome.vue' import Authorized from '../views/user/Authorized.vue' const routes: Array = [ @@ -22,6 +23,11 @@ const routes: Array = [ name: 'Authorized', component: Authorized, props: (route) => ({ code: route.query.code }) + }, + { + path: '/citizen/welcome', + name: 'Welcome', + component: Welcome } ] diff --git a/src/jobs-jobs-jobs/src/views/user/Authorized.vue b/src/jobs-jobs-jobs/src/views/user/Authorized.vue index f17f1ec..5ceec23 100644 --- a/src/jobs-jobs-jobs/src/views/user/Authorized.vue +++ b/src/jobs-jobs-jobs/src/views/user/Authorized.vue @@ -1,8 +1,9 @@ \ No newline at end of file