add routes for getRandomFiles
"t": string, the tagID, empty string stand for all tags
This commit is contained in:
@@ -1,11 +1,15 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useQuery } from "./Common";
|
||||||
import FilesTable from "./FilesTable";
|
import FilesTable from "./FilesTable";
|
||||||
|
|
||||||
function GetRandomFiles(props) {
|
function GetRandomFiles(props) {
|
||||||
const [files, setFiles] = useState([]);
|
const [files, setFiles] = useState([]);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [tags, setTags] = useState([]);
|
const [tags, setTags] = useState([]);
|
||||||
const [selectedTag, setSelectedTag] = useState("");
|
const navigator = useNavigate();
|
||||||
|
const query = useQuery();
|
||||||
|
const selectedTag = query.get("t") || "";
|
||||||
|
|
||||||
function getRandomFiles() {
|
function getRandomFiles() {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@@ -85,8 +89,9 @@ function GetRandomFiles(props) {
|
|||||||
<select
|
<select
|
||||||
className="tag_select"
|
className="tag_select"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setSelectedTag(event.target.value);
|
navigator(`/?t=${event.target.value}`);
|
||||||
}}
|
}}
|
||||||
|
value={selectedTag}
|
||||||
>
|
>
|
||||||
<option value="">All</option>
|
<option value="">All</option>
|
||||||
{tags.map((tag) => (
|
{tags.map((tag) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user