Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(routes): add redirect for single organization navigation (#781)

Corentin Thomasset7c5e68fbfcf9
diff --git a/.changeset/common-news-listen.md b/.changeset/common-news-listen.md
new file mode 100644
index 00000000..30f0ddf2
--- /dev/null
+++ b/.changeset/common-news-listen.md
@@ -0,0 +1,5 @@
+---
+"@papra/docker": patch
+---
+
+When navigating to / and having only one organization, get redirected to that organization
diff --git a/apps/papra-client/src/routes.tsx b/apps/papra-client/src/routes.tsx
index 90ee0ab8..ec9b0337 100644
--- a/apps/papra-client/src/routes.tsx
+++ b/apps/papra-client/src/routes.tsx
@@ -71,6 +71,10 @@ export const routes: RouteDefinition[] = [
<Navigate href={`/organizations/${getLatestOrganizationId()}`} />
</Match>
+ <Match when={getOrgs().length === 1}>
+ <Navigate href={`/organizations/${getOrgs()[0]?.id ?? ''}`} />
+ </Match>
+
<Match when={getOrgs().length > 0}>
<Navigate href="/organizations" />
</Match>