Skip to content

Commit d295ad6

Browse files
Improve documentation clarity for namespace option
Clarify that namespace is used for internal redirects and provide a concrete example showing when and how to use it when the forward path differs from the desired UI path structure.
1 parent 748b808 commit d295ad6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/fun_with_flags/ui/router.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ defmodule FunWithFlags.UI.Router do
44
55
## Options
66
7-
* `:namespace` - The namespace to mount the UI under (default: `""`)
7+
* `:namespace` - Path prefix for internal redirects. Use when the UI is mounted
8+
under a sub-path that differs from the forward path (default: `""`)
89
* `:disable_csrf` - Disable CSRF protection when the host application
910
provides its own CSRF protection (default: `false`)
1011
1112
## Usage
1213
13-
# Basic usage
14+
# Basic usage - UI available at /feature-flags/flags, /feature-flags/new, etc.
1415
forward "/feature-flags", FunWithFlags.UI.Router
1516
16-
# With namespace
17+
# With namespace - forward at /admin but UI redirects go to /admin/feature-flags/*
1718
forward "/admin", FunWithFlags.UI.Router, namespace: "feature-flags"
1819
1920
# Disable CSRF when host app provides protection

0 commit comments

Comments
 (0)