FIX: Minor changes. Need better path management.
This commit is contained in:
parent
24baf27050
commit
8215704795
@ -1,7 +1,7 @@
|
|||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {useNavigate} from "react-router-dom";
|
import {useNavigate} from "react-router-dom";
|
||||||
import DirectoryList from "../components/DirectoryList.jsx";
|
import DirectoryList from "../components/DirectoryList.jsx";
|
||||||
import PathDisplay from "../components/ PathDisplay.jsx";
|
import PathDisplay from "../components/PathDisplay.jsx";
|
||||||
import Navbar from "../components/Navbar.jsx";
|
import Navbar from "../components/Navbar.jsx";
|
||||||
import Error from "../components/Error.jsx";
|
import Error from "../components/Error.jsx";
|
||||||
|
|
||||||
@ -17,7 +17,6 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
console.log(`http://localhost:5000/v1/children?path=/${path.join("/")}`);
|
|
||||||
const response = await fetch(`http://localhost:5000/v1/children?path=/${path.join("/")}`)
|
const response = await fetch(`http://localhost:5000/v1/children?path=/${path.join("/")}`)
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Something went wrong");
|
console.error("Something went wrong");
|
||||||
@ -60,15 +59,16 @@ export default function Dashboard() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the path back to the default, home directory.
|
* Set the path back to the default.
|
||||||
*/
|
*/
|
||||||
const backHome = () => {
|
const backHome = () => {
|
||||||
|
// TODO: Fix this in production
|
||||||
setPath(["home", "azpect"]);
|
setPath(["home", "azpect"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add name to the path.
|
* Add name to the path.
|
||||||
* @param name Targe child
|
* @param name Target child
|
||||||
*/
|
*/
|
||||||
const appendPath = (name) => {
|
const appendPath = (name) => {
|
||||||
setPath([...path, name])
|
setPath([...path, name])
|
||||||
@ -113,7 +113,7 @@ export default function Dashboard() {
|
|||||||
body: JSON.stringify({filePaths: paths}),
|
body: JSON.stringify({filePaths: paths}),
|
||||||
});
|
});
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
throw new Error(`HTTP error! status: ${resp.status}`);
|
setError(`HTTP error! status: ${resp.status}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const blob = await resp.blob();
|
const blob = await resp.blob();
|
||||||
|
|||||||
Reference in New Issue
Block a user