@@ -31,7 +31,7 @@ export class AliceController {
3131 storageAdapter . get = async ( ) => {
3232 return await this . pocketbase . collection ( "homey" )
3333 . getFirstListItem ( `token = "${ token } "` )
34- . then ( item => JSON . parse ( item . storage || "{}" ) )
34+ . then ( item => item . storage || { } )
3535 . catch ( ( ) => ( { } ) ) ;
3636 } ;
3737
@@ -42,14 +42,11 @@ export class AliceController {
4242 const item = await this . pocketbase . collection ( "homey" ) . getOne ( homeyId ) . catch ( ( ) => undefined ) ;
4343 if ( item ) {
4444 await this . pocketbase . collection ( "homey" ) . update ( homeyId , {
45- token,
46- storage : JSON . stringify ( { ...JSON . parse ( item . storage || "{}" ) , ...storage } ) ,
45+ token, storage : { ...( item . storage || { } ) , ...storage }
4746 } ) ;
4847 } else {
4948 await this . pocketbase . collection ( "homey" ) . create ( {
50- id : homeyId ,
51- token,
52- storage : JSON . stringify ( storage ) ,
49+ id : homeyId , token, storage
5350 } ) ;
5451 }
5552 } ;
@@ -88,11 +85,11 @@ export class AliceController {
8885 async userRemove ( token : string ) {
8986 await this . getAthomUser ( token ) ;
9087 await this . pocketbase . collection ( "homey" )
91- . getFirstListItem ( `token = "${ token } "` )
92- . then ( async item => {
93- this . homeyApis . delete ( token ) ;
94- await this . pocketbase . collection ( "homey" ) . delete ( item . id ) ;
95- } ) ;
88+ . getFirstListItem ( `token = "${ token } "` )
89+ . then ( async item => {
90+ this . homeyApis . delete ( token ) ;
91+ await this . pocketbase . collection ( "homey" ) . delete ( item . id ) ;
92+ } ) ;
9693 }
9794
9895 async getDevices ( token : string ) : Promise < UserDevicesResponse [ "payload" ] > {
0 commit comments