refactor: let state use either local or backend
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-12 15:54:03 +02:00
parent 9cb3296cec
commit 2d63d3ad4c
6 changed files with 68 additions and 20 deletions

View File

@@ -24,13 +24,8 @@ impl UpdateGraphCommand {
let now = std::time::SystemTime::now();
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Initiated));
match self
.querier
.get_async(&root, path)
.await
.ok_or(anyhow::anyhow!("failed to find path"))
{
Ok(graph) => {
match self.querier.get_async(&root, path).await {
Ok(Some(graph)) => {
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Optimistic(
graph.clone(),
)));
@@ -42,6 +37,9 @@ impl UpdateGraphCommand {
dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Success(graph)))
}
Ok(None) => dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Failure(
"graph was not found user root".into(),
))),
Err(e) => dispatch.send(Msg::GraphUpdated(GraphUpdatedEvent::Failure(
format!("{e}"),
))),