+
+
+
diff --git a/stores/auth.ts b/stores/auth.ts
index 26b77ddb..d75a16ea 100644
--- a/stores/auth.ts
+++ b/stores/auth.ts
@@ -7,6 +7,7 @@ export const useAuth = defineStore('auth', {
jwtToken: '',
authHeader: {},
role: '',
+ uuid: null as null | string,
}),
getters: {},
@@ -56,6 +57,19 @@ export const useAuth = defineStore('auth', {
return code
},
+ async obtainUuid() {
+ await $fetch('/api/generate-uuid', {
+ method: 'POST',
+ headers: this.authHeader,
+ })
+ .then((response) => {
+ this.uuid = response.uuid
+ })
+ .catch(() => {
+ this.uuid = null
+ })
+ },
+
inspectToken() {
const token = useCookie('token').value
diff --git a/stores/config.ts b/stores/config.ts
index 9733ed27..6daca3e7 100644
--- a/stores/config.ts
+++ b/stores/config.ts
@@ -23,6 +23,7 @@ export const useConfig = defineStore('config', {
authStore.inspectToken()
if (authStore.isLogin) {
+ await authStore.obtainUuid()
await this.getGuiConfig()
await this.getPlayoutConfig()
await this.getUserConfig()
diff --git a/stores/index.ts b/stores/index.ts
index 4668783b..36cbe9d2 100644
--- a/stores/index.ts
+++ b/stores/index.ts
@@ -6,6 +6,7 @@ export const useIndex = defineStore('index', {
showAlert: false,
alertVariant: 'success',
alertMsg: '',
+ sseConnected: false,
}),
getters: {},
diff --git a/types/index.d.ts b/types/index.d.ts
index ae7162e1..83959874 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -17,6 +17,10 @@ declare global {
}
}
+ interface DataAuth {
+ uuid: string
+ }
+
interface GuiConfig {
id: number
config_path: string