initial commit - code moved to separate repo

This commit is contained in:
Dobromir Popov
2024-02-22 04:19:38 +02:00
commit 560d503219
240 changed files with 105125 additions and 0 deletions

View File

@ -0,0 +1,55 @@
//next.js page to show all locatons in the database with a link to the location page
import CartEventForm from "../../../components/cartevent/CartEventForm";
import Layout from "../../../components/layout";
import axiosServer from '../../../src/axiosServer';
import { ICartEventPageProps } from "./index";
export default function NewPage(props: ICartEventPageProps) {
return (
<Layout>
<div className="h-5/6 grid place-items-center">
<CartEventForm props={props} />
{/*
<AvailabilityForm id={item.id} publisherId={item.publisherId} /> */}
</div>
</Layout>
);
}
//------------------pages\cart\availabilities\edit\[id].tsx------------------
export const getServerSideProps = async (context) => {
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
const axios = await axiosServer(context);
const locations = await axios
.get(`${process.env.NEXTAUTH_URL}/api/data/locations?select=id,name`)
.then((res) => {
console.log("locations: " + JSON.stringify(res.data));
return res.data;
});
if (!context.query || !context.query.id) {
return {
props: {}
};
}
const { id } = context.query.id;
const { data: item } = await axiosInstance.get(
process.env.NEXTAUTH_URL + "/api/data/cartevents/" + context.params.id
);
return {
props: {
item: item,
locations: locations
},
};
};