Skip to content

Commit

Permalink
feat(lyrics): catch errors when creating lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
sifferhans committed Nov 29, 2024
1 parent 6660d52 commit aee82a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default defineNuxtConfig({
modules,
runtimeConfig: {
public: {
apiUrl: "https://bmm-api.brunstad.org",
apiUrl: "https://int-bmm-api.brunstad.org",
authUrl: "https://login.bcc.no",
clientId: "L9891KdcqtoKmHg4r65lT7zbSjv55dNN",
applicationInsights: "",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@
"vite-plugin-electron-renderer": "^0.14.5",
"vitest": "^1.2.2",
"vue-tsc": "^1.8.27"
}
},
"packageManager": "[email protected]+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a"
}
32 changes: 17 additions & 15 deletions pages/lyrics/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ const loading = ref(false);
async function createLyrics() {
loading.value = true;
await new LyricsApi().lyricsPost({
lyrics: {
songTitle: createForm.title,
source: "Manual",
longCopyright: DEFAULT_LONG_COPYRIGHT,
},
});
items.value = await new LyricsApi().lyricsGet();
resetForm();
loading.value = false;
showCreateDialog.value = false;
try {
await new LyricsApi().lyricsPost({
lyrics: {
songTitle: createForm.title,
source: "Manual",
longCopyright: DEFAULT_LONG_COPYRIGHT,
},
});
resetForm();
} catch (err) {
showErrorToUser("CreateLyricsFailed", "Failed to create lyrics");
} finally {
items.value = await new LyricsApi().lyricsGet();
loading.value = false;
showCreateDialog.value = false;
}
}
const search = useRouteQuery("search", "");
Expand Down Expand Up @@ -91,7 +93,7 @@ const filteredItems = computed(() => {
v-for="item in filteredItems"
:key="item.id"
class="col-span-full grid grid-cols-subgrid items-center justify-between gap-4 py-1"
:to="{ name: 'lyrics-id', params: { id: item.id } }"
:to="{ name: 'lyrics-id', params: { id: item.id! } }"
>
<p>
<span class="type-title-2">{{ item.songTitle }}</span>
Expand Down

0 comments on commit aee82a7

Please sign in to comment.