fix(stronghold): return null if there is no record (#129)

* [stronghold] return null if there is no record

* Return value

* return statement

* prettier

* fix function signature

* fix if condition

* simplify condition

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
pull/435/head
Ludea 2 years ago committed by GitHub
parent 0984fc8374
commit 6ad221ed36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -293,12 +293,18 @@ export class Store {
this.client = client;
}
async get(key: StoreKey): Promise<Uint8Array> {
async get(key: StoreKey): Promise<Uint8Array | null> {
return await invoke<number[]>("plugin:stronghold|get_store_record", {
snapshotPath: this.path,
client: this.client,
key: toBytesDto(key),
}).then((v) => Uint8Array.from(v));
}).then((v) => {
if (v) {
return Uint8Array.from(v);
} else {
return null;
}
});
}
async insert(

Loading…
Cancel
Save