This commit is contained in:
drgoodcat committed 2021-10-07 23:00:18 +02:00
commit 378d46cf46
6 files changed
+34 -11

No files matched your search

+2
View File
@@ -5,6 +5,7 @@ import { Dashboard } from "./pages/Dashboard";
import { Credits } from "./pages/Credits";
import { NotFound } from "./pages/NotFound";
import { Navbar } from "./components/Navbar";
import { Footer } from "./components/Footer";
import { CreateEvent } from "./pages/CreateEvent";
import { Event } from "./pages/Event";
import { API_CLIENT } from "./constants";
@@ -97,6 +98,7 @@ export const App = () => {
{routes}
<Route component={NotFound} />
</Switch>
<Footer/>
</Router>
);
};
@@ -16,10 +16,9 @@ export const EventPreviewEdit = (props) => {
minute: "2-digit",
});
};
const deleteItem = (arg) => {
const deleteItem = async (arg) => {
console.log("deleting..." + arg);
API_CLIENT.deleteEvent({ id: arg });
history.push("/");
await API_CLIENT.deleteEvent({ id: arg });
};
return (
<div className={styles.link}>
@@ -33,12 +32,10 @@ export const EventPreviewEdit = (props) => {
</div>
<div className="d-flex justify-content-between align-items-center ">
<span className={styles.time}>
<BIcon icon="calendar" />
{`${getDate(props.data.time)} ${getTime(props.data.time)}` ?? ""}
<BIcon icon="calendar" /> {`${getDate(props.data.time)} ${getTime(props.data.time)}` ?? ""}
</span>
<span className={styles.location}>
<BIcon icon="geo-alt-fill" />
{props.data.address?.split(", ").splice(0, 2).join(", ")}
<BIcon icon="geo-alt-fill" /> {props.data.address?.split(", ").splice(0, 2).join(", ")}
</span>
</div>
<div className="d-flex justify-content-between align-items-center ">
+10
View File
@@ -0,0 +1,10 @@
import { Link } from "react-router-dom";
import { BIcon } from "../BIcon";
import styles from "./index.module.scss";
export const Footer = () => {
return (
<div className={styles.footer}><Link aria-label="Credits" to="/credits" style={{ textDecoration: "none" }}><span className={styles.txt}>credits</span></Link></div>
);
};
@@ -0,0 +1,13 @@
@import "../../index.scss";
.footer{
position:absolute;
text-align:right;
bottom:0;
width: 100%;;
}
.txt{
color:#5873FF;
margin-right: 4vw;
font-size: 1.3em;
cursor:pointer;
}
+2 -1
View File
@@ -24,8 +24,9 @@ export class APIClient extends EventEmitter {
}
async deleteEvent(item) {
const rq = await axios.post(`${this.#dbUrl}/api/deleteEvent`,item);
const rq = await axios.post(`${this.#dbUrl}/api/deleteEvent`, item);
if (rq.status !== 200) throw new Error(`Request failed with status code ${rq.status}: ${rq.statusText}`);
await this.fetchEvents();
return rq.data;
}