File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
src/packages/frontend/account Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -244,4 +244,34 @@ export class AccountActions extends Actions<AccountState> {
244
244
// @ts -ignore
245
245
this . setState ( { fragment } ) ;
246
246
} ;
247
+
248
+ addTag = ( tag : string ) => {
249
+ const store = this . redux . getStore ( "account" ) ;
250
+ if ( ! store ) return ;
251
+ const tags = store . get ( "tags" ) ;
252
+ if ( tags ?. includes ( tag ) ) {
253
+ // already tagged
254
+ return ;
255
+ }
256
+ const table = this . redux . getTable ( "account" ) ;
257
+ if ( ! table ) return ;
258
+ const v = tags ?. toJS ( ) ?? [ ] ;
259
+ v . push ( tag ) ;
260
+ table . set ( { tags : v } ) ;
261
+ } ;
262
+
263
+ // delete won't be visible in frontend until a browser refresh...
264
+ deleteTag = async ( tag : string ) => {
265
+ const store = this . redux . getStore ( "account" ) ;
266
+ if ( ! store ) return ;
267
+ const tags = store . get ( "tags" ) ;
268
+ if ( ! tags ?. includes ( tag ) ) {
269
+ // already tagged
270
+ return ;
271
+ }
272
+ const table = this . redux . getTable ( "account" ) ;
273
+ if ( ! table ) return ;
274
+ const v = tags . toJS ( ) . filter ( ( x ) => x != tag ) ;
275
+ await webapp_client . async_query ( { query : { accounts : { tags : v } } } ) ;
276
+ } ;
247
277
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export class AccountTable extends Table {
47
47
ssh_keys : null ,
48
48
created : null ,
49
49
unlisted : null ,
50
- // tags: null,
50
+ tags : null ,
51
51
tours : null ,
52
52
purchase_closing_day : null ,
53
53
email_daily_statements : null ,
You can’t perform that action at this time.
0 commit comments