Skip to content

Commit 058ce24

Browse files
committed
perf: logic optimization
1 parent 73e694e commit 058ce24

File tree

17 files changed

+33
-17
lines changed

17 files changed

+33
-17
lines changed

apps/web-antd/src/api/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function createRequestClient(baseURL: string) {
5959
if (status >= 200 && status < 400 && code === 0) {
6060
return data;
6161
}
62-
throw new Error(msg);
62+
throw new Error(`Error ${status}: ${msg}`);
6363
});
6464
return client;
6565
}

apps/web-antd/src/locales/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) {
5858
locale = await import('dayjs/locale/en');
5959
}
6060
}
61-
dayjs.locale(locale);
61+
if (locale) {
62+
dayjs.locale(locale);
63+
} else {
64+
console.error(`Failed to load dayjs locale for ${lang}`);
65+
}
6266
}
6367

6468
/**

apps/web-antd/src/views/dashboard/analytics/analytics-trends.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

apps/web-antd/src/views/dashboard/analytics/analytics-visits.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

apps/web-ele/src/api/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function createRequestClient(baseURL: string) {
5959
if (status >= 200 && status < 400 && code === 0) {
6060
return data;
6161
}
62-
throw new Error(msg);
62+
throw new Error(`Error ${status}: ${msg}`);
6363
});
6464
return client;
6565
}

apps/web-ele/src/locales/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) {
5858
locale = await import('dayjs/locale/en');
5959
}
6060
}
61-
dayjs.locale(locale);
61+
if (locale) {
62+
dayjs.locale(locale);
63+
} else {
64+
console.error(`Failed to load dayjs locale for ${lang}`);
65+
}
6266
}
6367

6468
/**

apps/web-ele/src/views/dashboard/analytics/analytics-trends.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

apps/web-ele/src/views/dashboard/analytics/analytics-visits.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

apps/web-naive/src/api/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function createRequestClient(baseURL: string) {
5858
if (status >= 200 && status < 400 && code === 0) {
5959
return data;
6060
}
61-
throw new Error(msg);
61+
throw new Error(`Error ${status}: ${msg}`);
6262
});
6363
return client;
6464
}

apps/web-naive/src/views/dashboard/analytics/analytics-trends.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

apps/web-naive/src/views/dashboard/analytics/analytics-visits.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

docs/src/guide/essentials/server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function createRequestClient(baseURL: string) {
221221
if (status >= 200 && status < 400 && code === 0) {
222222
return data;
223223
}
224-
throw new Error(msg);
224+
throw new Error(`Error ${status}: ${msg}`);
225225
});
226226
return client;
227227
}

docs/src/guide/in-depth/locale.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) {
198198
locale = await import('dayjs/locale/en');
199199
}
200200
}
201-
dayjs.locale(locale);
201+
if (locale) {
202+
dayjs.locale(locale);
203+
} else {
204+
console.error(`Failed to load dayjs locale for ${lang}`);
205+
}
202206
}
203207
```
204208

playground/src/api/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function createRequestClient(baseURL: string) {
5959
if (status >= 200 && status < 400 && code === 0) {
6060
return data;
6161
}
62-
throw new Error(msg);
62+
throw new Error(`Error ${status}: ${msg}`);
6363
});
6464
return client;
6565
}

playground/src/locales/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) {
5858
locale = await import('dayjs/locale/en');
5959
}
6060
}
61-
dayjs.locale(locale);
61+
if (locale) {
62+
dayjs.locale(locale);
63+
} else {
64+
console.error(`Failed to load dayjs locale for ${lang}`);
65+
}
6266
}
6367

6468
/**

playground/src/views/dashboard/analytics/analytics-trends.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

playground/src/views/dashboard/analytics/analytics-visits.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ onMounted(() => {
1313
containLabel: true,
1414
left: '1%',
1515
right: '1%',
16-
top: '2 %',
16+
top: '2 %',
1717
},
1818
series: [
1919
{

0 commit comments

Comments
 (0)