@mongoosejs/studio 0.0.65 → 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.
- package/frontend/public/app.js +18 -6
- package/frontend/src/index.js +16 -6
- package/package.json +1 -1
package/frontend/public/app.js
CHANGED
|
@@ -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
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
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;
|
package/frontend/src/index.js
CHANGED
|
@@ -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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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;
|