Skip to content
Snippets Groups Projects
Commit d39e0893 authored by Antoine Detailleur's avatar Antoine Detailleur
Browse files

Merge branch 'feature/NRRPLT-8003-move-experiment-list-directi' of...

Merge branch 'feature/NRRPLT-8003-move-experiment-list-directi' of bitbucket.org:hbpneurorobotics/nrp-frontend into feature/NRRPLT-8003-move-experiment-list-directi
parents 44442c46 de7b67e3
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,9 @@ dist/
# JetBrains IDE
.idea/
# VS Code
.vscode/
# Unit test reports
TEST*.xml
......
......@@ -26,7 +26,16 @@
"extends": [
"react-app",
"react-app/jest"
]
],
"rules": {
"quotes": ["error", "single"],
"indent": ["error", 2],
"curly": ["error", "all"],
"block-spacing": ["error", "always"],
"brace-style": ["error", "stroustrup"],
"comma-dangle": ["error", "never"],
"no-trailing-spaces": "error"
}
},
"browserslist": {
"production": [
......
......@@ -12,7 +12,8 @@ class App extends React.Component {
try {
const experiments = await ExperimentsService.instance.getExperiments();
console.log(experiments);
} catch (error) {
}
catch (error) {
console.error(`Failed to fetch the list of experiments. Error: ${error}`);
}
}
......
......@@ -36,7 +36,9 @@ class AuthenticationService {
const path = window.location.href;
const accessTokenMatch = /&access_token=([^&]*)/.exec(path);
if (!accessTokenMatch || !accessTokenMatch[1]) return;
if (!accessTokenMatch || !accessTokenMatch[1]) {
return;
}
let accessToken = accessTokenMatch[1];
......@@ -71,7 +73,8 @@ class AuthenticationService {
try {
let tokens = JSON.parse(storedItem);
return tokens.length ? tokens[tokens.length - 1].access_token : null;
} catch (e) {
}
catch (e) {
// this token will be rejected by the server and the client will get a proper auth error
return 'malformed-token';
}
......@@ -86,7 +89,9 @@ class AuthenticationService {
this.clearStoredToken();
let absoluteUrl = /^https?:\/\//i;
if (!absoluteUrl.test(url)) url = `${this.PROXY_URL}${url}`;
if (!absoluteUrl.test(url)) {
url = `${this.PROXY_URL}${url}`;
}
window.location.href = `${url}&client_id=${
this.CLIENT_ID
}&redirect_uri=${encodeURIComponent(window.location.href)}`;
......
......@@ -41,7 +41,8 @@ export class HttpService {
if (response.status === 477) {
const responseText = await response.text();
AuthenticationService.instance.openAuthenticationPage(responseText);
} else if (response.status === 478) {
}
else if (response.status === 478) {
//TODO: redirect to maintenance page
}
......
......@@ -63,6 +63,7 @@ class NrpUserService extends HttpService {
if (!this.currentUser) {
this.currentUser = await this.httpRequestGET(this.IDENTITY_ME_URL);
}
return this.currentUser;
}
......@@ -88,8 +89,7 @@ class NrpUserService extends HttpService {
*/
async isGroupMember(groupName) {
return await this.getCurrentUserGroups().then((groups) =>
groups.some((g) => g.name === groupName)
);
groups.some((g) => g.name === groupName));
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment