Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

🚨 Resolves warning about dual-method import

Alicia Sykesaa4c7a0e71a2
diff --git a/src/utils/languages.js b/src/utils/languages.js
index 94471aba..772d2a92 100644
--- a/src/utils/languages.js
+++ b/src/utils/languages.js
@@ -37,9 +37,15 @@ export const languages = [
export const messages = { en };
+const loaders = import.meta.glob([
+ '../assets/locales/*.json',
+ '!../assets/locales/en.json', // Exclude English, needed as default + fallback
+]);
export const loadLocale = async (code) => {
if (code === 'en') return en;
- const mod = await import(`../assets/locales/${code}.json`);
+ const loader = loaders[`../assets/locales/${code}.json`];
+ if (!loader) throw new Error(`Unsupported locale: ${code}`);
+ const mod = await loader();
return mod.default;
};
diff --git a/src/utils/request.js b/src/utils/request.js
index cab42e42..0d33e7ba 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -7,6 +7,8 @@
* Throws on non-2xx responses (matching axios behavior)
*/
+import { makeBasicAuthHeaders } from '@/utils/auth/Auth';
+
/** Check if a request URL targets the local Dashy server */
function isLocalRequest(url) {
if (!url) return false;
@@ -63,7 +65,6 @@ async function makeRequest(config) {
// For local API requests, include basic auth headers when configured
if (isLocalRequest(fullUrl) && !fetchOptions.headers.Authorization) {
- const { makeBasicAuthHeaders } = await import('@/utils/auth/Auth');
const authConfig = makeBasicAuthHeaders();
if (authConfig.headers) {
Object.assign(fetchOptions.headers, authConfig.headers);