1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-29 03:41:09 +00:00

add protected routes

This commit is contained in:
Felix Ableitner 2024-11-21 14:56:32 +01:00
parent 7f1ecd3e5c
commit 59c0a3bf90
3 changed files with 12 additions and 8 deletions

View file

@ -1,14 +1,17 @@
use crate::frontend::components::protected_route::IbisProtectedRoute;
use crate::{ use crate::{
common::SiteView, common::SiteView,
frontend::{ frontend::{
api::CLIENT, api::CLIENT,
components::nav::Nav, components::{nav::Nav, protected_route::IbisProtectedRoute},
dark_mode::DarkMode, dark_mode::DarkMode,
pages::{ pages::{
article::{ article::{
actions::ArticleActions, create::CreateArticle, edit::EditArticle, actions::ArticleActions,
history::ArticleHistory, list::ListArticles, read::ReadArticle, create::CreateArticle,
edit::EditArticle,
history::ArticleHistory,
list::ListArticles,
read::ReadArticle,
}, },
diff::EditDiff, diff::EditDiff,
instance::{details::InstanceDetails, list::ListInstances}, instance::{details::InstanceDetails, list::ListInstances},
@ -59,7 +62,7 @@ impl<T: Default + Send + Sync> DefaultResource<T> for Resource<T> {
} }
pub fn shell(options: LeptosOptions) -> impl IntoView { pub fn shell(options: LeptosOptions) -> impl IntoView {
view! { view! {
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />

View file

@ -4,4 +4,4 @@ pub mod credentials;
pub mod editor; pub mod editor;
pub mod instance_follow_button; pub mod instance_follow_button;
pub mod nav; pub mod nav;
pub mod protected_route; pub mod protected_route;

View file

@ -1,9 +1,10 @@
use crate::frontend::app::is_logged_in;
use leptos::prelude::*; use leptos::prelude::*;
use leptos_router::{ use leptos_router::{
components::{ProtectedRoute, ProtectedRouteProps}, components::{ProtectedRoute, ProtectedRouteProps},
NestedRoute, SsrMode, NestedRoute,
SsrMode,
}; };
use crate::frontend::app::is_logged_in;
#[component(transparent)] #[component(transparent)]
pub fn IbisProtectedRoute<Segments, ViewFn, View>( pub fn IbisProtectedRoute<Segments, ViewFn, View>(