25 lines
767 B
TypeScript
25 lines
767 B
TypeScript
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.PUBLIC_URL}/api/data/cartevents/` + id);
|
|
const locations = await axios
|
|
.get(`${process.env.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,
|
|
},
|
|
};
|
|
}; |