From 970d27d9d5d50c386fe5c24c14edf109014bbcaf Mon Sep 17 00:00:00 2001 From: Puneet Aggarwal Date: Fri, 19 Mar 2021 23:31:35 +0530 Subject: [PATCH] Added logout action (#22) Co-authored-by: Puneet Aggarwal --- src/actions/get_options.ts | 2 +- src/actions/logout.ts | 9 +++++++++ src/actions/setup.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/actions/logout.ts diff --git a/src/actions/get_options.ts b/src/actions/get_options.ts index 3642c63..0c1f6b2 100644 --- a/src/actions/get_options.ts +++ b/src/actions/get_options.ts @@ -4,7 +4,7 @@ import { accessToken } from '../utils/constants' const returnOptions = () => { if (!accessToken) { return JSON.stringify({ - remove: ['search', 'orgs'], + remove: ['search', 'orgs', 'logout'], }) } else { return JSON.stringify({ diff --git a/src/actions/logout.ts b/src/actions/logout.ts new file mode 100644 index 0000000..900e480 --- /dev/null +++ b/src/actions/logout.ts @@ -0,0 +1,9 @@ +// @description Logout from github automation package +setVars([ + { + name: 'accessToken', + value: '', + }, +], { local: true }) +notify('Access token removedd successfully', 'success', 3000) +reIndex([]) \ No newline at end of file diff --git a/src/actions/setup.ts b/src/actions/setup.ts index da23e9d..7ff60c9 100644 --- a/src/actions/setup.ts +++ b/src/actions/setup.ts @@ -57,7 +57,7 @@ if (currentUrl.indexOf('login') === -1) { }, ], { local: true }) notify('Access token added successfully', 'success', 3000) - reIndex() + reIndex([]) } } else { notify('Please login into your github account first', 'error', 3000)