Use undefined for empty value in get

This commit is contained in:
Tony
2024-10-04 10:11:13 +08:00
parent 1ef9f6a487
commit 831105d7a8
4 changed files with 17 additions and 9 deletions
+4 -2
View File
@@ -131,9 +131,11 @@ async fn get<R: Runtime>(
app: AppHandle<R>,
rid: ResourceId,
key: String,
) -> Result<Option<JsonValue>> {
) -> Result<(Option<JsonValue>, bool)> {
let store = app.resources_table().get::<Store<R>>(rid)?;
Ok(store.get(key))
let value = store.get(key);
let exists = value.is_some();
Ok((value, exists))
}
#[tauri::command]