@@ -155,43 +155,17 @@ qx.Class.define("osparc.form.tag.TagManager", {
155155 return tagButton ;
156156 } ,
157157
158- __getAddTagPromise : function ( tagId ) {
159- const params = {
160- url : {
161- tagId,
162- studyId : this . __resourceId
163- }
164- } ;
165- return osparc . data . Resources . fetch ( "studies" , "addTag" , params ) ;
166- } ,
167-
168- __getRemoveTagPromise : function ( tagId ) {
169- const params = {
170- url : {
171- tagId,
172- studyId : this . __resourceId
173- }
174- } ;
175- return osparc . data . Resources . fetch ( "studies" , "removeTag" , params ) ;
176- } ,
177-
178158 __saveAddTag : function ( tagId , tagButton ) {
179- this . __getAddTagPromise ( tagId )
159+ osparc . store . Study . addTag ( this . __resourceId , tagId )
180160 . then ( ( ) => this . __selectedTags . push ( tagId ) )
181- . catch ( err => {
182- console . error ( err ) ;
183- tagButton . setValue ( false ) ;
184- } )
161+ . catch ( ( ) => tagButton . setValue ( false ) )
185162 . finally ( ( ) => tagButton . setFetching ( false ) ) ;
186163 } ,
187164
188165 __saveRemoveTag : function ( tagId , tagButton ) {
189- this . __getRemoveTagPromise ( tagId )
166+ osparc . store . Study . removeTag ( this . __resourceId , tagId )
190167 . then ( ( ) => this . __selectedTags . remove ( tagId ) )
191- . catch ( err => {
192- console . error ( err ) ;
193- tagButton . setValue ( true ) ;
194- } )
168+ . catch ( ( ) => tagButton . setValue ( true ) )
195169 . finally ( ( ) => tagButton . setFetching ( false ) ) ;
196170 } ,
197171
@@ -203,14 +177,14 @@ qx.Class.define("osparc.form.tag.TagManager", {
203177 for ( let i = 0 ; i < this . __selectedTags . length ; i ++ ) {
204178 const tagId = this . __selectedTags . getItem ( i ) ;
205179 if ( ! this . __studyData [ "tags" ] . includes ( tagId ) ) {
206- updatedStudy = await this . __getAddTagPromise ( tagId )
180+ updatedStudy = await osparc . store . Study . addTag ( this . __resourceId , tagId )
207181 . then ( updatedData => updatedData ) ;
208182 }
209183 }
210184 for ( let i = 0 ; i < this . __studyData [ "tags" ] . length ; i ++ ) {
211185 const tagId = this . __studyData [ "tags" ] [ i ] ;
212186 if ( ! this . __selectedTags . includes ( tagId ) ) {
213- updatedStudy = await this . __getRemoveTagPromise ( tagId )
187+ updatedStudy = await osparc . store . Study . removeTag ( this . __resourceId , tagId )
214188 . then ( updatedData => updatedData ) ;
215189 }
216190 }
0 commit comments