File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
services/static-webserver/client/source/class/osparc/store Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ qx.Class.define("osparc.store.Users", {
2828 } ,
2929
3030 members : {
31- fetchUser : function ( groupId ) {
31+ __fetchUser : function ( groupId ) {
3232 const params = {
3333 url : {
3434 gid : groupId
@@ -41,14 +41,23 @@ qx.Class.define("osparc.store.Users", {
4141 } ) ;
4242 } ,
4343
44- getUser : function ( groupId , fetchIfNotFound = true ) {
44+ getUser : async function ( groupId , fetchIfNotFound = true ) {
4545 const userFound = this . getUsers ( ) . find ( user => user . getGroupId ( ) === groupId ) ;
4646 if ( userFound ) {
47- return new Promise ( resolve => resolve ( userFound ) ) ;
48- } else if ( fetchIfNotFound ) {
49- return this . fetchUser ( groupId ) ;
47+ return userFound ;
5048 }
51- return new Promise ( reject => reject ( ) ) ;
49+ if ( fetchIfNotFound ) {
50+ try {
51+ const user = await this . __fetchUser ( groupId ) ;
52+ if ( user ) {
53+ return user ;
54+ }
55+ } catch ( error ) {
56+ console . error ( error ) ;
57+ return null ;
58+ }
59+ }
60+ return null ;
5261 } ,
5362
5463 addUser : function ( userData ) {
You can’t perform that action at this time.
0 commit comments