diff --git a/components/ui/Popups/ErrorNetwork/ErrorNetwork.html b/components/ui/Popups/ErrorNetwork/ErrorNetwork.html
new file mode 100644
index 0000000000..b8b81605b6
--- /dev/null
+++ b/components/ui/Popups/ErrorNetwork/ErrorNetwork.html
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/locales/en-US.js b/locales/en-US.js
index 757681cd4d..99ca730a4d 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -126,6 +126,12 @@ export default {
contact:
'Oops! Something went wrong! Help us improve your experience by sending an error report',
},
+ error_network: {
+ title: 'Oops! Please Stand By',
+ subtitle:
+ "We're currently in our Alpha stage and working hard on connecting you to a satellite. It looks like we're having some technical issues at the moment. Please re-enter your pin to connect or try again later.",
+ action: 'Try Again',
+ },
},
files: {
files: 'Files',
diff --git a/pages/auth/register/index.vue b/pages/auth/register/index.vue
index 3649ddac2e..e1c7bb94ed 100644
--- a/pages/auth/register/index.vue
+++ b/pages/auth/register/index.vue
@@ -42,17 +42,30 @@ export default Vue.extend({
},
watch: {
allPrerequisitesReady(nextValue) {
+ console.log(nextValue)
if (!nextValue) return
this.$router.replace('/chat/direct')
},
},
+ mounted() {
+ if (this.allPrerequisitesReady) {
+ this.$router.replace('/chat/direct')
+ }
+ },
methods: {
async confirm(userData: UserRegistrationData) {
- this.$store.dispatch('accounts/registerUser', {
- name: userData.username,
- image: userData.photoHash,
- status: userData.status,
- })
+ try {
+ await this.$store.dispatch('accounts/registerUser', {
+ name: userData.username,
+ image: userData.photoHash,
+ status: userData.status,
+ })
+ } catch (error: any) {
+ this.$store.commit('ui/toggleErrorNetworkModal', {
+ state: true,
+ action: () => this.confirm(userData),
+ })
+ }
},
},
})
diff --git a/pages/index.vue b/pages/index.vue
index 8d6b833855..62b707e3b5 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -72,10 +72,17 @@ export default Vue.extend({
} catch (error: any) {
if (error.message === AccountsError.USER_NOT_REGISTERED) {
this.$router.replace('/auth/register')
+ return
}
if (error.message === AccountsError.USER_DERIVATION_FAILED) {
this.$router.replace('/setup/disclaimer')
+ return
}
+
+ this.$store.commit('ui/toggleErrorNetworkModal', {
+ state: true,
+ action: this.loadAccount,
+ })
}
},
},
diff --git a/store/ui/__snapshots__/state.test.ts.snap b/store/ui/__snapshots__/state.test.ts.snap
index 511de442b4..b6819330fa 100644
--- a/store/ui/__snapshots__/state.test.ts.snap
+++ b/store/ui/__snapshots__/state.test.ts.snap
@@ -54,6 +54,10 @@ Object {
"creategroup": false,
"crop": false,
"error": false,
+ "errorNetwork": Object {
+ "action": null,
+ "isOpen": false,
+ },
"glyph": false,
"groupInvite": Object {
"isOpen": false,
diff --git a/store/ui/mutations.ts b/store/ui/mutations.ts
index 9ee483e672..314d71b6f6 100644
--- a/store/ui/mutations.ts
+++ b/store/ui/mutations.ts
@@ -103,6 +103,13 @@ export default {
// @ts-ignore
state.modals[modal.name] = modal.state
},
+ toggleErrorNetworkModal(
+ state: UIState,
+ modal: { state: boolean; action: Function | null },
+ ) {
+ // @ts-ignore
+ state.modals.errorNetwork = { isOpen: modal.state, action: modal.action }
+ },
setGlyphModalPack(state: UIState, pack: string) {
state.glyphModalPack = pack
},
diff --git a/store/ui/state.ts b/store/ui/state.ts
index 187ba805b9..0b72a63ddd 100644
--- a/store/ui/state.ts
+++ b/store/ui/state.ts
@@ -37,6 +37,7 @@ const InitialUIState = (): UIState => ({
callToAction: false,
renameFile: false,
crop: false,
+ errorNetwork: { isOpen: false, action: null },
},
glyphModalPack: '',
chatbarContent: '',
diff --git a/store/ui/types.ts b/store/ui/types.ts
index 34258f36a2..2ddbf947c2 100644
--- a/store/ui/types.ts
+++ b/store/ui/types.ts
@@ -170,7 +170,7 @@ export interface UIState {
showSearchResult: boolean
showSidebar: boolean
modals: {
- [key: string]: boolean
+ [key: string]: boolean | object
}
glyphModalPack: string
chatbarContent: string