From 899b064a5916fd27497e034773707dadd23589ff Mon Sep 17 00:00:00 2001 From: Bogdan Artemenko Date: Thu, 7 Feb 2019 09:12:20 +0200 Subject: [PATCH] Added congratulations page after registration. Implemented Account confirmation argument validation. (#1253) * Added congratulations page after registration. Implemented Account confirmation argument validation. --- web/satellite/src/App.vue | 2 + web/satellite/src/api/users.ts | 37 +++++++++++++++++++ .../common/RegistrationSuccessPopup.vue | 19 ++++++++-- web/satellite/src/store/modules/appState.ts | 15 +++++++- web/satellite/src/store/modules/users.ts | 14 ++++--- web/satellite/src/store/mutationConstants.ts | 1 + .../src/utils/constants/actionNames.ts | 2 + web/satellite/src/views/Dashboard.vue | 20 +++++++++- web/satellite/src/views/Register.vue | 11 +++--- 9 files changed, 104 insertions(+), 17 deletions(-) diff --git a/web/satellite/src/App.vue b/web/satellite/src/App.vue index 51610f132..9808af400 100644 --- a/web/satellite/src/App.vue +++ b/web/satellite/src/App.vue @@ -37,6 +37,8 @@ import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; 'addTeamMemberPopupButtonSVG', 'sortTeamMemberByDropdown', 'sortTeamMemberByDropdownButton', + 'createAccountButton', + 'successfulRegistrationPopup', ] }; }, diff --git a/web/satellite/src/api/users.ts b/web/satellite/src/api/users.ts index aa31a4c88..d8e12006a 100644 --- a/web/satellite/src/api/users.ts +++ b/web/satellite/src/api/users.ts @@ -247,3 +247,40 @@ export async function deleteAccountRequest(password: string): Promise> { + let result: RequestResponse = { + errorMessage: '', + isSuccess: false, + data: '' + }; + + try { + let response = await apolloManager.mutate( + { + mutation: gql(` + mutation { + activateAccount(input: "${token}") { + token + } + } + `), + fetchPolicy: 'no-cache' + + } + ); + + if (response.errors) { + result.errorMessage = response.errors[0].message; + } else { + result.isSuccess = true; + } + } catch (e) { + result.errorMessage = e.message; + } + + return result; +} diff --git a/web/satellite/src/components/common/RegistrationSuccessPopup.vue b/web/satellite/src/components/common/RegistrationSuccessPopup.vue index 48ce9f7ce..ce1d0d29f 100644 --- a/web/satellite/src/components/common/RegistrationSuccessPopup.vue +++ b/web/satellite/src/components/common/RegistrationSuccessPopup.vue @@ -2,8 +2,8 @@ // See LICENSE for copying information. @@ -78,10 +78,9 @@ import { Component, Vue } from 'vue-property-decorator'; import HeaderedInput from '@/components/common/HeaderedInput.vue'; import Checkbox from '@/components/common/Checkbox.vue'; import Button from '@/components/common/Button.vue'; -import RegistrationSuccessPopup from '@/components/common/RegistrationSuccessPopup'; +import RegistrationSuccessPopup from '@/components/common/RegistrationSuccessPopup.vue'; import { validateEmail, validatePassword } from '@/utils/validation'; -import ROUTES from '../utils/constants/routerConstants'; -import { NOTIFICATION_ACTIONS } from '../utils/constants/actionNames'; +import { APP_STATE_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames'; import { createUserRequest } from '@/api/users'; @Component( @@ -156,7 +155,7 @@ import { createUserRequest } from '@/api/users'; return; } - this.$router.push(ROUTES.LOGIN.path); + this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SUCCESSFUL_REGISTRATION_POPUP); } }, data: function (): RegisterData {