Upgraded APIS to use the new Nubian ones

This commit is contained in:
Elijah Dunemask 2021-11-18 00:23:24 +00:00
parent 690ce1ef7b
commit 13b31997a5
4 changed files with 9 additions and 7 deletions

View file

@ -4,6 +4,7 @@ COPY package.json .
RUN npm i
COPY public public
COPY src src
ARG REACT_APP_CAIRO_URL
RUN npm run build:react
COPY server server
CMD ["npm", "start"]

View file

@ -10,7 +10,7 @@ import PropTypes from "prop-types";
import "./scss/stash/FileBox.scss";
class FileBox extends React.Component {
readableDate() {
let d = new Date(parseInt(this.props.file.date));
let d = new Date(Date.parse(this.props.file.created));
if (isNaN(d.getMonth())) return "";
return `${
d.getMonth() + 1
@ -34,7 +34,9 @@ class FileBox extends React.Component {
>
<div className="file">
<div className="file-details">
<span className="file-name">{this.props.file.name}</span>
<span className="file-name">
{this.props.file.original_filename}
</span>
</div>
<div className="file-details">
<span className="file-date">{this.readableDate()}</span>

View file

@ -40,7 +40,7 @@ class StashBoard extends React.Component {
return toast.error("Error Loading Files");
var fileBoxes = {};
res.data.forEach((file, index) => {
fileBoxes[file._id] = buildFilebox(file, index);
fileBoxes[file.id] = buildFilebox(file, index);
});
this.setState({ fileBoxes });
})
@ -64,7 +64,7 @@ class StashBoard extends React.Component {
addFilebox(file) {
var fileBoxes = this.state.fileBoxes;
fileBoxes[file._id] = buildFilebox(file, Object.keys(fileBoxes).length);
fileBoxes[file.id] = buildFilebox(file, Object.keys(fileBoxes).length);
this.setState({ fileBoxes });
}

View file

@ -64,7 +64,7 @@ export default class StashContextMenu extends React.Component {
this.props.fileBoxesChanged(fileBoxes);
}
handleDownload(url, file) {
const downloadName = `${file.date}-${file.name}`;
const downloadName = `${file.filename}`;
const config = {
method: "GET",
"Content-Type": "application/octet-stream",
@ -72,7 +72,7 @@ export default class StashContextMenu extends React.Component {
onDownloadProgress: (e) =>
this.props.updateDownload(downloadId, e.loaded, e.total),
};
const downloadId = this.props.startDownload(file.name);
const downloadId = this.props.startDownload(file.filename);
window.cairoApi.request(url, config).then((response) => {
if (response.status !== 200)
return toast.error("There was an error downloading that!");
@ -87,7 +87,6 @@ export default class StashContextMenu extends React.Component {
*/
handleDelete(res, selectedBoxes) {
const failedFiles = res.data || [];
console.log(res);
if (res.status !== 200) toast.error("Error Deleting Some Files");
let fileBoxes = this.props.fileBoxes;
selectedBoxes.forEach((selectedBoxId) => {