Fetches the calendar home set
This commit is contained in:
parent
3f7de0e802
commit
de3c9cd7c5
7 changed files with 1159 additions and 13 deletions
|
@ -3,6 +3,7 @@
|
|||
//! This gives access to data from both the server and a local database for quick retrieval when the app starts
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::error::Error;
|
||||
|
||||
mod calendar;
|
||||
mod task;
|
||||
|
@ -29,13 +30,14 @@ impl DataSource {
|
|||
}
|
||||
|
||||
/// Tell this data source what the source server is
|
||||
pub fn set_server(&mut self, url: String, username: String, password: String) {
|
||||
self.client = Client::new(url, username, password);
|
||||
pub fn set_server(&mut self, url: String, username: String, password: String) -> Result<(), Box<dyn Error>> {
|
||||
self.client = Some(Client::new(url, username, password)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update the local database with info from the Client
|
||||
pub fn fetch_from_server(&self) {
|
||||
// TODO: how to handle conflicts?
|
||||
pub fn fetch_from_server(&mut self) {
|
||||
|
||||
}
|
||||
|
||||
pub fn update_changes_to_server(&self) {
|
||||
|
@ -45,7 +47,6 @@ impl DataSource {
|
|||
pub fn calendars(&self) -> Vec<&Calendar> {
|
||||
self.calendars
|
||||
.iter()
|
||||
.map(|c| &c)
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue