some stuff
This commit is contained in:
parent
885069cafb
commit
9a64c7a95b
|
@ -55,7 +55,7 @@ ValidateBody(j.object({
|
||||||
})),
|
})),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
if (req.user?.BookmarkedSongs.findIndex(x => x.ID.toLowerCase() === req.body.SongID.toLowerCase()) !== -1)
|
if (req.user?.BookmarkedSongs.findIndex(x => x.ID.toLowerCase() === req.body.SongID.toLowerCase()) !== -1)
|
||||||
return res.status(400).json({ errorMessage: "This song is already bookmarked." });
|
return res.status(400).json({ errorMessage: "You're already subscribed to this song." });
|
||||||
|
|
||||||
const SongData = await Song.findOne({ where: { ID: req.body.SongID } });
|
const SongData = await Song.findOne({ where: { ID: req.body.SongID } });
|
||||||
if (!SongData)
|
if (!SongData)
|
||||||
|
@ -75,7 +75,7 @@ ValidateBody(j.object({
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const idx = req.user!.BookmarkedSongs.findIndex(x => x.ID.toLowerCase() === req.body.SongID.toLowerCase());
|
const idx = req.user!.BookmarkedSongs.findIndex(x => x.ID.toLowerCase() === req.body.SongID.toLowerCase());
|
||||||
if (idx === -1)
|
if (idx === -1)
|
||||||
return res.status(400).json({ errorMessage: "This song is not bookmarked." });
|
return res.status(400).json({ errorMessage: "You arent subscribed to this song." });
|
||||||
|
|
||||||
req.user?.BookmarkedSongs.splice(idx, 1);
|
req.user?.BookmarkedSongs.splice(idx, 1);
|
||||||
req.user?.save();
|
req.user?.save();
|
||||||
|
|
|
@ -26,16 +26,6 @@ export function AdminTrackList() {
|
||||||
{
|
{
|
||||||
tracks.map(x => {
|
tracks.map(x => {
|
||||||
return <Song data={x}>
|
return <Song data={x}>
|
||||||
<Button sx={{ width: "100%", marginBottom: 1 }} variant="primary" onClick={async () => {
|
|
||||||
const Res = await axios.post("/api/library/me/bookmark", { SongID: x.ID });
|
|
||||||
if (Res.status === 200)
|
|
||||||
{
|
|
||||||
toast("Success!");
|
|
||||||
navigate("/profile");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
toast(Res.data.errorMessage, { type: "error" })
|
|
||||||
}}>Subscribe</Button>
|
|
||||||
<Button sx={{ width: "100%", marginBottom: 1 }}>View Details</Button>
|
<Button sx={{ width: "100%", marginBottom: 1 }}>View Details</Button>
|
||||||
<Button sx={{ width: "100%" }} variant="danger">Disable</Button>
|
<Button sx={{ width: "100%" }} variant="danger">Disable</Button>
|
||||||
</Song>
|
</Song>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user