🔷 refactor context menu to accept context src

🔷 add a getCurrentDate function to get formatted date
This commit is contained in:
geoffrey45
2022-04-08 21:07:24 +03:00
parent 24db32ae09
commit 83330a7fad
13 changed files with 107 additions and 44 deletions
+6
View File
@@ -17,3 +17,9 @@ export enum FromOptions {
album = "album",
search = "search",
}
export enum ContextSrc {
PHeader = "PHeader",
Track = "Track",
AHeader = "AHeader",
}
+15
View File
@@ -150,9 +150,24 @@ 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 -1
View File
@@ -2,7 +2,7 @@ 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,6 +13,7 @@ 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!");