Remove email address from local database if user removes it

This commit is contained in:
Joseph T. Lyons 2023-12-06 19:26:25 -05:00
parent bbe9986f38
commit 57a9f024e7

View File

@ -152,11 +152,18 @@ impl FeedbackModal {
cx.spawn(|this, mut cx| async move {
let answer = answer.await.ok();
if answer == Some(0) {
if let Some(email) = email.clone() {
let _ = KEY_VALUE_STORE
.write_kvp(DATABASE_KEY_NAME.to_string(), email)
.await;
}
match email.clone() {
Some(email) => {
let _ = KEY_VALUE_STORE
.write_kvp(DATABASE_KEY_NAME.to_string(), email)
.await;
}
None => {
let _ = KEY_VALUE_STORE
.delete_kvp(DATABASE_KEY_NAME.to_string())
.await;
}
};
this.update(&mut cx, |feedback_editor, cx| {
feedback_editor.set_pending_submission(true, cx);