sse support
This commit is contained in:
+6
-1
@@ -5,7 +5,12 @@
|
||||
{{- $stores := .Accounts.GetShops $acctID -}}
|
||||
|
||||
|
||||
<table id="accounts-acct-id-inventory-sync-groups-draft-table" class="max-w-full overflow-x-auto">
|
||||
<table
|
||||
id="accounts-acct-id-inventory-sync-groups-draft-table"
|
||||
class="max-w-full overflow-x-auto"
|
||||
hx-get="{{ printf "/ui/accounts/%d/inventory/sync-groups/draft/table" $acctID }}"
|
||||
hx-trigger="sse:{{ printf "accounts_%d_inventory_sync-groups_draft" $acctID }}"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
|
||||
<script src="/scripts/htmx.min.js.gz"></script>
|
||||
<script src="/scripts/_hyperscript.min.js.gz"></script>
|
||||
<script src="https://unpkg.com/htmx-ext-path-params@2.0.0/path-params.js"></script>
|
||||
<script src="/scripts/htmx-ext-sse.js"></script>
|
||||
<script src="/scripts/htmx-ext-path-params.js"></script>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
||||
@@ -22,7 +23,16 @@
|
||||
{{- block "head" . }}{{ end }}
|
||||
</head>
|
||||
|
||||
<body class="basis-full grow bg-background flex flex-col items-stretch" hx-ext="path-params">
|
||||
<body
|
||||
class="basis-full grow bg-background flex flex-col items-stretch"
|
||||
hx-ext="path-params,sse"
|
||||
|
||||
{{/* subscribe to sse (if logged in) */}}
|
||||
{{- if and .Identity .Identity.AccessToken }}
|
||||
sse-connect="/api/events/"
|
||||
sse-close="close"
|
||||
{{- end }}
|
||||
>
|
||||
<header>
|
||||
<nav class="flex flex-col items-center text-xl overflow-x-scroll overflow-y-hidden ">
|
||||
{{- $path := or .Request.URL.Path "/" }}
|
||||
|
||||
Reference in New Issue
Block a user