Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit fbec1cd

Browse files
committed
Amend syntax for readability
1 parent 17e66e2 commit fbec1cd

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/dashboard/cd-dashboard-projects.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,15 @@
5252
},
5353
methods: {
5454
async loadProjects(locale = 'en') {
55-
await ProjectsService.list(locale, { order: 'desc' })
56-
.then((data) => {
57-
const projects = data.body;
58-
if (projects) {
59-
this.projects = projects.data.slice(0, 3);
60-
}
61-
})
62-
.catch(() => {
63-
// If the request fails it is most likely to be the
64-
// locale and we will then fall back to the 'en' locale
65-
});
55+
try {
56+
const projects = (await ProjectsService.list(locale, { order: 'desc' })).body;
57+
if (projects) {
58+
this.projects = projects.data.slice(0, 3);
59+
}
60+
} catch (err) {
61+
// If the request fails it is most likely to be the
62+
// locale and we will then fall back to the 'en' locale
63+
}
6664
},
6765
},
6866
async created() {

0 commit comments

Comments
 (0)