@innertia-solutions/innertia-nuxt 0.1.47 → 0.1.48
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.
|
@@ -30,7 +30,8 @@ const items = computed(() => tab.value === 'unread'
|
|
|
30
30
|
? store.notifications.filter(n => !n.read_at)
|
|
31
31
|
: store.notifications)
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const liveUnread = computed(() => Math.max(serverUnread.value, store.unreadCount))
|
|
34
|
+
const badge = computed(() => liveUnread.value > 9 ? '9+' : String(liveUnread.value))
|
|
34
35
|
|
|
35
36
|
async function load() {
|
|
36
37
|
loading.value = true
|
|
@@ -53,6 +53,29 @@ export function useRealtime() {
|
|
|
53
53
|
options.wssPort = pusherWsPort ? Number(pusherWsPort) : 443
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// Authorizer para canales private-*: postea al /broadcasting/auth del backend
|
|
57
|
+
// con headers frescos (Bearer + X-Tenant) reconstruidos en cada intento.
|
|
58
|
+
const apiBase = config.public.apiBaseUrl || '/api'
|
|
59
|
+
options.channelAuthorization = {
|
|
60
|
+
transport: 'ajax',
|
|
61
|
+
endpoint: `${apiBase}/broadcasting/auth`,
|
|
62
|
+
// Handler propio: reconstruye headers (token/X-Tenant) en cada auth.
|
|
63
|
+
customHandler: async ({ socketId, channelName }, callback) => {
|
|
64
|
+
try {
|
|
65
|
+
const headers = {}
|
|
66
|
+
run(headers)
|
|
67
|
+
const res = await $fetch(`${apiBase}/broadcasting/auth`, {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
headers,
|
|
70
|
+
body: { socket_id: socketId, channel_name: channelName },
|
|
71
|
+
})
|
|
72
|
+
callback(null, res)
|
|
73
|
+
} catch (err) {
|
|
74
|
+
callback(err, null)
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
56
79
|
pusher.value = new Pusher(pusherAppKey, options)
|
|
57
80
|
|
|
58
81
|
pusher.value.connection.bind('connected', () => {
|
package/package.json
CHANGED
package/stores/gym.js
CHANGED
|
@@ -7,7 +7,7 @@ import { defineStore } from 'pinia'
|
|
|
7
7
|
* gyms: [{ key, name, status, contexts }]
|
|
8
8
|
*/
|
|
9
9
|
export const useGymStore = defineStore('gym', {
|
|
10
|
-
state: () => ({ activeKey: null, gyms: [] }),
|
|
10
|
+
state: () => ({ activeKey: null, activeContext: null, gyms: [] }),
|
|
11
11
|
|
|
12
12
|
getters: {
|
|
13
13
|
active: (s) => s.gyms.find((g) => g.key === s.activeKey) || null,
|
|
@@ -17,11 +17,13 @@ export const useGymStore = defineStore('gym', {
|
|
|
17
17
|
actions: {
|
|
18
18
|
setGyms(gyms) { this.gyms = gyms || [] },
|
|
19
19
|
setActive(key) { this.activeKey = key },
|
|
20
|
-
|
|
20
|
+
// Contexto elegido (backoffice/student/…) — un gym puede otorgar varios.
|
|
21
|
+
setActiveContext(context) { this.activeContext = context },
|
|
22
|
+
reset() { this.activeKey = null; this.activeContext = null; this.gyms = [] },
|
|
21
23
|
},
|
|
22
24
|
|
|
23
25
|
persist: {
|
|
24
|
-
//
|
|
25
|
-
pick: ['activeKey'],
|
|
26
|
+
// Key + contexto activos sobreviven el refresh; la lista se recarga del backend.
|
|
27
|
+
pick: ['activeKey', 'activeContext'],
|
|
26
28
|
},
|
|
27
29
|
})
|