-
+ >
}
}
\ No newline at end of file
diff --git a/src/routes/main_router.rs b/src/routes/main_router.rs
index aa04ab8..e7c005e 100644
--- a/src/routes/main_router.rs
+++ b/src/routes/main_router.rs
@@ -3,7 +3,7 @@ use yew::prelude::*;
use uuid::Uuid;
-use crate::{pages::{landing::LandingPage, search::{SearchPage}, details::DetailsPage, not_found::NotFoundPage, contact::ContactPage, admin::{login::AdminLoginPage, start::AdminStart}, agents::AgentsPage}};
+use crate::{pages::{landing::LandingPage, search::{SearchPage}, details::DetailsPage, not_found::NotFoundPage, contact::ContactPage, admin::{login::AdminLoginPage, start::AdminStart, projects::AdminProjects, agents::AdminAgents, contacts::AdminContacts}, agents::AgentsPage}};
#[derive(Clone, Routable, PartialEq)]
pub enum Route {
@@ -22,6 +22,12 @@ pub enum Route {
Admin,
#[at("/admin/start")]
AdminStart,
+ #[at("/admin/projects")]
+ AdminProjects,
+ #[at("/admin/agents")]
+ AdminAgents,
+ #[at("/admin/contacts")]
+ AdminContacts,
#[not_found]
#[at("/404")]
@@ -39,6 +45,10 @@ pub fn switch(routes: Route) -> Html {
Route::Admin => html! {
},
Route::AdminStart => html! {
},
+ Route::AdminProjects => html! {
},
+ Route::AdminAgents => html! {
},
+ Route::AdminContacts => html! {
},
+
}
}
\ No newline at end of file
diff --git a/src/utils/admin_panel.rs b/src/utils/admin_panel.rs
new file mode 100644
index 0000000..78153b9
--- /dev/null
+++ b/src/utils/admin_panel.rs
@@ -0,0 +1,12 @@
+use super::storage;
+
+
+pub fn get_admin_token_from_storage() -> Option
{
+ match storage::get_from_local_storage(storage::StorageKey::AdminUser) {
+ Ok(opt) => opt,
+ Err(_) => {
+ log::error!("No user stored when attempting to use admin panel. Redirect to admin panel.");
+ None
+ },
+ }
+}
\ No newline at end of file
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index 47709df..30b2736 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -1,3 +1,4 @@
pub mod get_value;
pub mod input;
-pub mod storage;
\ No newline at end of file
+pub mod storage;
+pub mod admin_panel;
\ No newline at end of file
diff --git a/src/utils/storage.rs b/src/utils/storage.rs
index 2705fef..3e96c1f 100644
--- a/src/utils/storage.rs
+++ b/src/utils/storage.rs
@@ -1,15 +1,17 @@
-use std::fmt::Display;
+use std::fmt::{Display};
use err::{MessageResource, Error};
use web_sys::window;
pub enum StorageKey {
AgentShortcode,
+ AdminUser,
}
impl Display for StorageKey {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
StorageKey::AgentShortcode => write!(f, "agentshortcode"),
+ StorageKey::AdminUser => write!(f, "adminuser"),
}
}
}