From da06b9bcc94c35e39693daf7b04ed8fca01e06c9 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Sat, 26 Mar 2022 12:38:48 +0300 Subject: [PATCH] Show error notification on http 409 --- src/composables/playlists.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/composables/playlists.ts b/src/composables/playlists.ts index db9a688..2f6c9e4 100644 --- a/src/composables/playlists.ts +++ b/src/composables/playlists.ts @@ -1,6 +1,6 @@ import axios from "axios"; import { Playlist } from "../interfaces"; -import { Notification } from "../stores/notification"; +import { Notification, NotificationType } from "../stores/notification"; import state from "./state"; /** @@ -12,12 +12,13 @@ async function createNewPlaylist(playlist_name: string) { .post(state.settings.uri + "/playlist/new", { name: playlist_name, }) - .then((res) => { - console.log(res.data); - new Notification("Playlist created!"); + .then(() => { + new Notification("✅ Playlist created successfullly!"); }) .catch((err) => { - console.error(err); + if (err.response.status == 409) { + new Notification("❌ Playlist already exists!", NotificationType.Error); + } }); }