htmx-router 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/components.js +1 -1
- package/bin/router.js +3 -1
- package/bin/shared.d.ts +1 -1
- package/package.json +1 -1
package/bin/components.js
CHANGED
|
@@ -26,6 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.Link = void 0;
|
|
27
27
|
const elements = __importStar(require("typed-html"));
|
|
28
28
|
function Link(props, contents) {
|
|
29
|
-
return elements.createElement("a", { target: props.target || "", style: props.style || "", href: props.to, "hx-get": props.to }, contents);
|
|
29
|
+
return elements.createElement("a", { target: props.target || "", style: props.style || "", href: props.to, "hx-get": props.to, "hx-headers": '{"Cache-Control": "no-cache"}' }, contents);
|
|
30
30
|
}
|
|
31
31
|
exports.Link = Link;
|
package/bin/router.js
CHANGED
|
@@ -51,8 +51,10 @@ class RouteLeaf {
|
|
|
51
51
|
}
|
|
52
52
|
async render(args, mask, routeName) {
|
|
53
53
|
try {
|
|
54
|
+
// Always check auth
|
|
55
|
+
// If auth error this function will throw
|
|
54
56
|
if (this.module.Auth)
|
|
55
|
-
|
|
57
|
+
await this.module.Auth(args);
|
|
56
58
|
if (mask === render_args_1.MaskType.show) {
|
|
57
59
|
if (this.module.Render)
|
|
58
60
|
return await this.module.Render(routeName, args);
|
package/bin/shared.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { RenderArgs } from "./render-args";
|
|
|
5
5
|
export type Outlet = () => Promise<string>;
|
|
6
6
|
export type CatchFunction = (routeName: string, args: RenderArgs, err: ErrorResponse) => Promise<string>;
|
|
7
7
|
export type RenderFunction = (routeName: string, args: RenderArgs) => Promise<string>;
|
|
8
|
-
export type AuthFunction = (args: RenderArgs) => Promise<
|
|
8
|
+
export type AuthFunction = (args: RenderArgs) => Promise<void>;
|
|
9
9
|
export type RouteModule = {
|
|
10
10
|
Render?: RenderFunction;
|
|
11
11
|
CatchError?: CatchFunction;
|