mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 03:40:14 +00:00
Added Forget/Delete button functionality
This commit is contained in:
parent
1dcc4c2e78
commit
db14aabcac
@ -57,4 +57,21 @@ export const sendDeleteAllQueuedIgnored = async (token: string, filter: string):
|
|||||||
// return response.json();
|
// return response.json();
|
||||||
}
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const sendDeleteVideoQueuedIgnored = async (token: string, videoId: string): Promise<Download> => {
|
||||||
|
const response = await fetch(`${TA_BASE_URL.server}/api/download/${videoId}/`, {
|
||||||
|
headers: {
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: `Token ${token}`,
|
||||||
|
mode: "no-cors",
|
||||||
|
},
|
||||||
|
method: "DELETE"
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
// throw new Error("Error adding content to the download queue.");
|
||||||
|
// return response.json();
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
};
|
};
|
@ -5,7 +5,7 @@ import { dehydrate, QueryClient, useQuery } from "react-query";
|
|||||||
import { CustomHead } from "../components/CustomHead";
|
import { CustomHead } from "../components/CustomHead";
|
||||||
import { Layout } from "../components/Layout";
|
import { Layout } from "../components/Layout";
|
||||||
import NextImage from "next/image";
|
import NextImage from "next/image";
|
||||||
import { getDownloads, sendDeleteAllQueuedIgnored } from "../lib/getDownloads";
|
import { getDownloads, sendDeleteAllQueuedIgnored, sendDeleteVideoQueuedIgnored } from "../lib/getDownloads";
|
||||||
import { sendDownloads } from "../lib/getDownloads";
|
import { sendDownloads } from "../lib/getDownloads";
|
||||||
import RescanIcon from "../images/icon-rescan.svg";
|
import RescanIcon from "../images/icon-rescan.svg";
|
||||||
import DownloadIcon from "../images/icon-download.svg";
|
import DownloadIcon from "../images/icon-download.svg";
|
||||||
@ -237,8 +237,8 @@ const Download: NextPage = () => {
|
|||||||
{/* <p>Published: {{ video.source.published }} | Duration: {{ video.source.duration }} | {{ video.source.youtube_id }}</p> */}
|
{/* <p>Published: {{ video.source.published }} | Duration: {{ video.source.duration }} | {{ video.source.youtube_id }}</p> */}
|
||||||
{ignoredStatus &&
|
{ignoredStatus &&
|
||||||
<div>
|
<div>
|
||||||
<button data-id={`${video?.youtube_id}`} onClick={() => console.log("forgetIgnore(this)")}>Forget</button>
|
|
||||||
<button data-id={`${video?.youtube_id}`} onClick={() => console.log("addSingle(this)")}>Add to queue</button>
|
<button data-id={`${video?.youtube_id}`} onClick={() => console.log("addSingle(this)")}>Add to queue</button>
|
||||||
|
<button data-id={`${video?.youtube_id}`} onClick={() => sendDeleteVideoQueuedIgnored(session.ta_token.token, video?.youtube_id)}>Forget</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{/* {% if show_ignored_only %} */}
|
{/* {% if show_ignored_only %} */}
|
||||||
@ -248,6 +248,7 @@ const Download: NextPage = () => {
|
|||||||
<div>
|
<div>
|
||||||
<button data-id={`${video?.youtube_id}`} onClick={() => console.log("toIgnore(this)")}>Ignore</button>
|
<button data-id={`${video?.youtube_id}`} onClick={() => console.log("toIgnore(this)")}>Ignore</button>
|
||||||
<button id={`${video?.youtube_id}`} data-id={`${video?.youtube_id}`} onClick={() => console.log("downloadNow(this)")}>Download now</button>
|
<button id={`${video?.youtube_id}`} data-id={`${video?.youtube_id}`} onClick={() => console.log("downloadNow(this)")}>Download now</button>
|
||||||
|
<button data-id={`${video?.youtube_id}`} onClick={() => sendDeleteVideoQueuedIgnored(session.ta_token.token, video?.youtube_id)}>Forget</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{/* {% else %} */}
|
{/* {% else %} */}
|
||||||
|
Loading…
Reference in New Issue
Block a user