import NewPage from "../new";

import axiosServer from '../../../../src/axiosServer';
export default NewPage;

export const getServerSideProps = async (context) => {
    console.log("edit page getServerSideProps");
    const axios = await axiosServer(context);
    const { id } = context.query;
    const { data } = await axios.get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/cartevents/` + id);
    const locations = await axios
        .get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations?select=id,name`)
        .then((res) => {
            console.log("locations: " + JSON.stringify(res.data));
            return res.data;
        });

    return {
        props: {
            item: data,
            locations: locations,
            inline: false,
        },
    };
};