mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-23 10:00:18 +00:00
Show error notification on http 409
This commit is contained in:
parent
ed4725a279
commit
da06b9bcc9
@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Playlist } from "../interfaces";
|
import { Playlist } from "../interfaces";
|
||||||
import { Notification } from "../stores/notification";
|
import { Notification, NotificationType } from "../stores/notification";
|
||||||
import state from "./state";
|
import state from "./state";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,12 +12,13 @@ async function createNewPlaylist(playlist_name: string) {
|
|||||||
.post(state.settings.uri + "/playlist/new", {
|
.post(state.settings.uri + "/playlist/new", {
|
||||||
name: playlist_name,
|
name: playlist_name,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
console.log(res.data);
|
new Notification("✅ Playlist created successfullly!");
|
||||||
new Notification("Playlist created!");
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
if (err.response.status == 409) {
|
||||||
|
new Notification("❌ Playlist already exists!", NotificationType.Error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user