Update configs
This commit is contained in:
parent
517f6c0eac
commit
cf858d6a71
38
composables/useLocalStorage.ts
Normal file
38
composables/useLocalStorage.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
// composables/useLocalStorage.ts
|
||||
import { ref, watchEffect } from "vue";
|
||||
|
||||
export const useLocalStorage = <T>(key: string, defaultValue: T) => {
|
||||
const state = ref<T>(defaultValue);
|
||||
|
||||
// Only run on client-side
|
||||
if (process.client) {
|
||||
const readValue = () => {
|
||||
try {
|
||||
const item = window.localStorage.getItem(key);
|
||||
return item ? (JSON.parse(item) as T) : defaultValue;
|
||||
} catch (error) {
|
||||
console.warn(`Error reading localStorage key "${key}":`, error);
|
||||
return defaultValue;
|
||||
}
|
||||
};
|
||||
|
||||
state.value = readValue();
|
||||
|
||||
watchEffect(() => {
|
||||
try {
|
||||
window.localStorage.setItem(key, JSON.stringify(state.value));
|
||||
} catch (error) {
|
||||
console.warn(`Error setting localStorage key "${key}":`, error);
|
||||
}
|
||||
});
|
||||
|
||||
// Handle storage events from other tabs
|
||||
window.addEventListener("storage", (event) => {
|
||||
if (event.key === key) {
|
||||
state.value = readValue();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return state;
|
||||
};
|
|
@ -51,7 +51,7 @@ export default defineNuxtConfig({
|
|||
nitro: {
|
||||
compressPublicAssets: true,
|
||||
prerender: {
|
||||
routes: ["/haditha/about-us", "/haditha/contact-us"], // Pre-render these routes
|
||||
routes: ["/haditha", "/haditha/about-us", "/haditha/contact-us"], // Pre-render these routes
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -102,7 +102,7 @@ export default defineNuxtConfig({
|
|||
dir: `./systems/${buildName.substring(
|
||||
0,
|
||||
buildName.length - 1
|
||||
)}_ui/assets/${buildName}/font-icons`,
|
||||
)}_ui/assets/${buildName}/font-icons/*.svg`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -172,6 +172,7 @@ export default defineNuxtConfig({
|
|||
"@chat": "~/systems/chat_ui",
|
||||
},
|
||||
vite: {
|
||||
assetsInclude: ['**/*.svg'],
|
||||
resolve: {},
|
||||
// optimizeDeps: {
|
||||
// exclude: ["vue-demi"],
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 05d548399b8d931e7e0c90abe31e96d345f01dca
|
||||
Subproject commit 8fd63ea1722b6b74d6ed9472e2103eab917af6f3
|
Loading…
Reference in New Issue
Block a user