mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
move "determining last updated date" to the server
This commit is contained in:
@@ -49,7 +49,6 @@ import { onMounted, ref } from "vue";
|
||||
import { Playlist } from "../../interfaces";
|
||||
import { updatePlaylist } from "../../composables/playlists";
|
||||
import usePStore from "../../stores/p.ptracks";
|
||||
import { getCurrentDate } from "../../composables/perks";
|
||||
|
||||
const pStore = usePStore();
|
||||
|
||||
@@ -103,7 +102,6 @@ function update_playlist(e: Event) {
|
||||
const formData = new FormData(form);
|
||||
|
||||
formData.append("image", image);
|
||||
formData.append("lastUpdated", getCurrentDate());
|
||||
|
||||
if (formData.get("name").toString().trim() !== "") {
|
||||
updatePlaylist(props.playlist.playlistid, formData, pStore).then(() => {
|
||||
|
||||
@@ -75,24 +75,10 @@ function formatSeconds(seconds) {
|
||||
}
|
||||
}
|
||||
|
||||
export function getCurrentDate() {
|
||||
const date = new Date();
|
||||
|
||||
const yyyy = date.getFullYear();
|
||||
const mm = date.getMonth() + 1;
|
||||
const dd = date.getDate();
|
||||
|
||||
const hh = date.getHours();
|
||||
const min = date.getMinutes();
|
||||
const sec = date.getSeconds();
|
||||
|
||||
return `${yyyy}-${mm}-${dd} ${hh}:${min}:${sec}`;
|
||||
}
|
||||
|
||||
export default {
|
||||
putCommas,
|
||||
focusCurrent,
|
||||
formatSeconds,
|
||||
getElem,
|
||||
getCurrentDate,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ import axios from "axios";
|
||||
import { Playlist, Track } from "../interfaces";
|
||||
import { Notification, NotifType } from "../stores/notification";
|
||||
import state from "./state";
|
||||
import { getCurrentDate } from "../composables/perks";
|
||||
/**
|
||||
* Creates a new playlist on the server.
|
||||
* @param playlist_name The name of the playlist to create.
|
||||
@@ -13,7 +12,6 @@ async function createNewPlaylist(playlist_name: string, track?: Track) {
|
||||
await axios
|
||||
.post(state.settings.uri + "/playlist/new", {
|
||||
name: playlist_name,
|
||||
lastUpdated: getCurrentDate(),
|
||||
})
|
||||
.then((res) => {
|
||||
new Notification("✅ Playlist created successfullly!");
|
||||
@@ -29,7 +27,7 @@ async function createNewPlaylist(playlist_name: string, track?: Track) {
|
||||
.catch((err) => {
|
||||
if (err.response.status == 409) {
|
||||
new Notification(
|
||||
"That playlist already exists ... you might want to try another name!",
|
||||
"That playlist already exists",
|
||||
NotifType.Error
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user