mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 03:40:14 +00:00
Added Ignore and Add back to queue functionality
This commit is contained in:
parent
db14aabcac
commit
494d97ee60
@ -74,4 +74,25 @@ export const sendDeleteVideoQueuedIgnored = async (token: string, videoId: strin
|
|||||||
// return response.json();
|
// return response.json();
|
||||||
}
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const sendMoveVideoQueuedIgnored = async (token: string, videoId: string, status: string): Promise<Download> => {
|
||||||
|
var data = {
|
||||||
|
"status": status
|
||||||
|
};
|
||||||
|
const response = await fetch(`${TA_BASE_URL.server}/api/download/${videoId}/`, {
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: `Token ${token}`,
|
||||||
|
mode: "no-cors",
|
||||||
|
},
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
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, sendDeleteVideoQueuedIgnored } from "../lib/getDownloads";
|
import { getDownloads, sendDeleteAllQueuedIgnored, sendDeleteVideoQueuedIgnored, sendMoveVideoQueuedIgnored } 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("addSingle(this)")}>Add to queue</button>
|
<button data-id={`${video?.youtube_id}`} onClick={() => sendMoveVideoQueuedIgnored(session.ta_token.token, video?.youtube_id, "pending")}>Add to queue</button>
|
||||||
<button data-id={`${video?.youtube_id}`} onClick={() => sendDeleteVideoQueuedIgnored(session.ta_token.token, video?.youtube_id)}>Forget</button>
|
<button title="Remove video from the ignored list." onClick={() => sendDeleteVideoQueuedIgnored(session.ta_token.token, video?.youtube_id)}>Remove</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{/* {% if show_ignored_only %} */}
|
{/* {% if show_ignored_only %} */}
|
||||||
@ -246,9 +246,9 @@ const Download: NextPage = () => {
|
|||||||
{/* <button data-id="{{ video.source.youtube_id }}" onclick="addSingle(this)">Add to queue</button> */}
|
{/* <button data-id="{{ video.source.youtube_id }}" onclick="addSingle(this)">Add to queue</button> */}
|
||||||
{!ignoredStatus &&
|
{!ignoredStatus &&
|
||||||
<div>
|
<div>
|
||||||
<button data-id={`${video?.youtube_id}`} onClick={() => console.log("toIgnore(this)")}>Ignore</button>
|
<button data-id={`${video?.youtube_id}`} onClick={() => sendMoveVideoQueuedIgnored(session.ta_token.token, video?.youtube_id, "ignore")}>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>
|
<button title="Delete video from the queue." onClick={() => sendDeleteVideoQueuedIgnored(session.ta_token.token, video?.youtube_id)}>Delete</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{/* {% else %} */}
|
{/* {% else %} */}
|
||||||
|
Loading…
Reference in New Issue
Block a user