feat: implement admin login page
This commit is contained in:
1 parent
838ae8ba0f
commit
b422e43288
3 files changed
+27
-22
No files matched your search
@@ -116,6 +116,7 @@ fn LoanerRoutes() -> impl MatchNestedRoutes + Clone {
|
|||||||
fn AdminRoutes() -> impl MatchNestedRoutes + Clone {
|
fn AdminRoutes() -> impl MatchNestedRoutes + Clone {
|
||||||
view! {
|
view! {
|
||||||
<ParentRoute path=path!("admin") view=AdminShell>
|
<ParentRoute path=path!("admin") view=AdminShell>
|
||||||
|
<Route path=path!("callback") view=AuthCallbackPage />
|
||||||
<Route path=path!("home") view=AdminHomePage />
|
<Route path=path!("home") view=AdminHomePage />
|
||||||
<Route path=path!("providers") view=AdminProviderPage />
|
<Route path=path!("providers") view=AdminProviderPage />
|
||||||
<Route path=path!("scholarships") view=AdminScholarshipPage />
|
<Route path=path!("scholarships") view=AdminScholarshipPage />
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
use leptos::prelude::*;
|
use crate::components::login::setup::provide_auth_context;
|
||||||
use crate::components::login::setup::provide_auth_context;
|
use leptos::prelude::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn AdminLoginContext(
|
pub fn AdminLoginContext(children: Children) -> impl IntoView {
|
||||||
children: Children
|
|
||||||
) -> impl IntoView {
|
|
||||||
provide_auth_context(
|
provide_auth_context(
|
||||||
crate::utils::use_origin(),
|
crate::utils::use_origin(),
|
||||||
"https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Lfjuy5zaM",
|
"https://cognito-idp.us-east-1.amazonaws.com/us-east-1_rvCU4Xy4j",
|
||||||
"56c2bqvl021rv8d5mq36blt7jv",
|
"1vh1q994rid6cgi6tjf58r9jp4",
|
||||||
"/providers/callback"
|
"/admin/callback",
|
||||||
);
|
);
|
||||||
|
|
||||||
view! { {children()} }
|
view! { {children()} }
|
||||||
}
|
}
|
||||||
+19
-13
@@ -1,7 +1,9 @@
|
|||||||
use leptos::prelude::*;
|
use crate::common::TabInfo;
|
||||||
use crate::common::TabInfo;
|
|
||||||
use crate::components::{Banner, TabSidebarList};
|
|
||||||
use crate::components::login::AdminLoginContext;
|
use crate::components::login::AdminLoginContext;
|
||||||
|
use crate::components::{Banner, Loading, TabSidebarList};
|
||||||
|
use crate::pages::UnauthenticatedPage;
|
||||||
|
use leptos::prelude::*;
|
||||||
|
use leptos_oidc::{AuthLoaded, Authenticated};
|
||||||
|
|
||||||
/// # Admin Shell Component
|
/// # Admin Shell Component
|
||||||
///
|
///
|
||||||
@@ -13,16 +15,20 @@ pub fn AdminShell() -> impl IntoView {
|
|||||||
view! {
|
view! {
|
||||||
<AdminLoginContext>
|
<AdminLoginContext>
|
||||||
<Banner title="R15 Scholarships Admin" logo="/PHS_Stacked_Acronym.png" />
|
<Banner title="R15 Scholarships Admin" logo="/PHS_Stacked_Acronym.png" />
|
||||||
// We'll put the tabs here.
|
<AuthLoaded fallback=Loading>
|
||||||
<TabSidebarList
|
<Authenticated unauthenticated=UnauthenticatedPage>
|
||||||
base_path="admin"
|
// We'll put the tabs here.
|
||||||
tabs=vec![
|
<TabSidebarList
|
||||||
TabInfo::new("Home", "home", None),
|
base_path="admin"
|
||||||
TabInfo::new("Providers", "providers", None),
|
tabs=vec![
|
||||||
TabInfo::new("Scholarships", "scholarships", None),
|
TabInfo::new("Home", "home", None),
|
||||||
TabInfo::new("Utilities", "utilities", None),
|
TabInfo::new("Providers", "providers", None),
|
||||||
]
|
TabInfo::new("Scholarships", "scholarships", None),
|
||||||
/>
|
TabInfo::new("Utilities", "utilities", None),
|
||||||
|
]
|
||||||
|
/>
|
||||||
|
</Authenticated>
|
||||||
|
</AuthLoaded>
|
||||||
</AdminLoginContext>
|
</AdminLoginContext>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user