@mongoosejs/studio 0.0.64 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2131,6 +2131,8 @@ module.exports = app => app.component('team', {
2131
2131
  status: 'loading'
2132
2132
  }),
2133
2133
  async mounted() {
2134
+ window.pageState = this;
2135
+
2134
2136
  const { workspace, users, invitations } = await mothership.getWorkspaceTeam();
2135
2137
  this.workspace = workspace;
2136
2138
  this.users = users;
@@ -11220,14 +11222,24 @@ app.component('app-component', {
11220
11222
  const href = window.location.href;
11221
11223
  if (href.match(/\?code=([a-zA-Z0-9]+)$/)) {
11222
11224
  const code = href.match(/\?code=([a-zA-Z0-9]+)$/)[1];
11223
- const { accessToken, user, roles } = await mothership.github(code);
11224
- if (roles == null) {
11225
- this.authError = 'You are not authorized to access this workspace';
11225
+ try {
11226
+ const { accessToken, user, roles } = await mothership.github(code);
11227
+ if (roles == null) {
11228
+ this.authError = 'You are not authorized to access this workspace';
11229
+ return;
11230
+ }
11231
+ this.user = user;
11232
+ this.roles = roles;
11233
+ window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
11234
+ } catch (err) {
11235
+ this.authError = 'An error occurred while logging in. Please try again.';
11236
+ this.status = 'loaded';
11226
11237
  return;
11238
+ } finally {
11239
+ setTimeout(() => {
11240
+ this.$router.replace(this.$router.currentRoute.value.path);
11241
+ }, 0);
11227
11242
  }
11228
- this.user = user;
11229
- this.roles = roles;
11230
- window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
11231
11243
 
11232
11244
  const { nodeEnv } = await api.status();
11233
11245
  this.nodeEnv = nodeEnv;
@@ -83,14 +83,24 @@ app.component('app-component', {
83
83
  const href = window.location.href;
84
84
  if (href.match(/\?code=([a-zA-Z0-9]+)$/)) {
85
85
  const code = href.match(/\?code=([a-zA-Z0-9]+)$/)[1];
86
- const { accessToken, user, roles } = await mothership.github(code);
87
- if (roles == null) {
88
- this.authError = 'You are not authorized to access this workspace';
86
+ try {
87
+ const { accessToken, user, roles } = await mothership.github(code);
88
+ if (roles == null) {
89
+ this.authError = 'You are not authorized to access this workspace';
90
+ return;
91
+ }
92
+ this.user = user;
93
+ this.roles = roles;
94
+ window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
95
+ } catch (err) {
96
+ this.authError = 'An error occurred while logging in. Please try again.';
97
+ this.status = 'loaded';
89
98
  return;
99
+ } finally {
100
+ setTimeout(() => {
101
+ this.$router.replace(this.$router.currentRoute.value.path);
102
+ }, 0);
90
103
  }
91
- this.user = user;
92
- this.roles = roles;
93
- window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
94
104
 
95
105
  const { nodeEnv } = await api.status();
96
106
  this.nodeEnv = nodeEnv;
@@ -14,6 +14,8 @@ module.exports = app => app.component('team', {
14
14
  status: 'loading'
15
15
  }),
16
16
  async mounted() {
17
+ window.pageState = this;
18
+
17
19
  const { workspace, users, invitations } = await mothership.getWorkspaceTeam();
18
20
  this.workspace = workspace;
19
21
  this.users = users;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "dependencies": {
5
5
  "archetype": "0.13.1",
6
6
  "csv-stringify": "6.3.0",