0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-12-06 14:52:41 +01:00

Refactor even more

This commit is contained in:
Delta1925 2023-04-13 22:26:41 +02:00
parent 7dc106ffd4
commit 9efbaefd92
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25
4 changed files with 49 additions and 48 deletions

View file

@ -9,15 +9,15 @@ use std::path::Path;
pub fn confirm_action(token: &str) -> Result<(), Error> {
let pending_path = pending_path!().join(token);
let data = if pending_path.exists() {
let content = if pending_path.exists() {
match fs::read_to_string(&pending_path) {
Ok(data) => data,
Ok(content) => content,
Err(_) => return Err(Error::Inaccessible),
}
} else {
return Err(Error::MissingPath);
};
let key = match serde_json::from_str::<Pending>(&data) {
let key = match serde_json::from_str::<Pending>(&content) {
Ok(key) => key,
Err(_) => return Err(Error::ParseStored),
};