mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
changed all extensions from js to jsx added proxies in vite config set up chunk for smaller distribution size remove setupProxy remove reportWebVitals
55 lines
1.1 KiB
JavaScript
55 lines
1.1 KiB
JavaScript
import React, {useState} from "react";
|
|
import axios from "axios";
|
|
import "../../css/error.css";
|
|
import { Button } from "react-bootstrap";
|
|
import Loading from "../general/loading";
|
|
|
|
function ItemNotFound(props) {
|
|
const [itemId] = useState(props.itemId);
|
|
const [loading,setLoading] = useState(false);
|
|
const token = localStorage.getItem('token');
|
|
|
|
async function fetchItem() {
|
|
setLoading(true);
|
|
const result = await axios
|
|
.post("/sync/fetchItem", {
|
|
itemId:itemId
|
|
}, {
|
|
headers: {
|
|
Authorization: `Bearer ${token}`,
|
|
"Content-Type": "application/json",
|
|
},
|
|
})
|
|
.catch((error) => {
|
|
setLoading(false);
|
|
console.log(error);
|
|
});
|
|
|
|
if(result)
|
|
{
|
|
|
|
await props.fetchdataMethod();
|
|
setLoading(false);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(loading)
|
|
{
|
|
return <Loading/>;
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
<div className="error">
|
|
<h1 className="error-title">{props.message}</h1>
|
|
|
|
<Button variant="primary" className="mt-3" onClick={()=> fetchItem()}>Fetch this item from Jellyfin</Button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default ItemNotFound; |