chore: refactor root view

This commit is contained in:
2025-02-10 15:24:42 +07:00
parent 0347e8b3c5
commit bfc9588738
8 changed files with 40 additions and 62 deletions

View File

@@ -226,15 +226,15 @@ impl AppView {
}
fn on_logout_action(&mut self, _action: &Logout, window: &mut Window, cx: &mut Context<Self>) {
cx.update_global::<AppRegistry, _>(|this, cx| {
cx.background_executor()
.spawn(async move { get_client().reset().await })
.detach();
cx.background_spawn(async move { get_client().reset().await })
.detach();
// Remove user
cx.update_global::<AppRegistry, _>(|this, _cx| {
this.set_user(None);
// Update root view
this.set_root_view(onboarding::init(window, cx).into(), cx);
});
window.replace_root(cx, |window, cx| {
Root::new(onboarding::init(window, cx).into(), window, cx)
});
}
}