message: backend main updated
diff: @@ -4,19 +4,7 @@ use shared::{UpMsg, DownMsg, Message, ClientId, ProjectId};
  mod client;
  mod project;
  -blocks!{
  - append_actors![client, project]
  -
  - #[var]
  - fn connector() -> Connector<UpMsg, DownMsg> {
  - Connector::new("9000", up_msg_handler)
  - }
  -
  - // @TODO `cor_id`?
  - // @TODO async + Result?
  - // @TODO #[index] in actor! or here?
  -
  - fn up_msg_handler(msg: UpMsg) -> DownMsg {
  +async fn up_msg_handler(msg: UpMsg) -> DownMsg {
  match msg {
  // ------ Page data ------
  UpMsg::GetClientsAndProjectsClients => {
  @@ -28,33 +16,32 @@ blocks!{
  // ------ Client ------
  UpMsg::AddClient(client_id) => {
  new_actor(Client { id: client_id }).await;
  - DownMsg::ClientAdded
  + send_down_msg(DownMsg::ClientAdded)
  },
  UpMsg::RemoveClient(client_id) => {
  client::by_id().get(client_id)[0].remove().await;
  - DownMsg::ClientRemoved
  + send_down_msg(DownMsg::ClientRemoved)
  },
  UpMsg::RenameClient(client_id, name) => {
  client::by_id().get(client_id)[0].rename(name.to_string()).await;
  - DownMsg::ClientRenamed
  + send_down_msg(DownMsg::ClientRenamed)
  },
  // ------ Project ------
  UpMsg::AddProject(client_id, project_id) => {
  new_actor(Project { client: client_id, id: project_id }).await;
  - DownMsg::ProjectAdded
  + send_down_msg(DownMsg::ProjectAdded)
  },
  UpMsg::RemoveProject(project_id) => {
  project::by_id().get(project_id)[0].await().remove().await;
  - DownMsg::ProjectRemoved
  + send_down_msg(DownMsg::ProjectRemoved)
  },
  UpMsg::RenameProject(project_id, name) => {
  project::by_id().get(project_id)[0].rename(name.to_string()).await;
  - DownMsg::ProjectRenamed
  + send_down_msg(DownMsg::ProjectRenamed)
  },
  }
  }
  -}
  fn main() {
  - start!()
  + start!(up_msg_handler, actors![client, project]);
  }
  