added iimages
This commit is contained in:
@@ -27,7 +27,7 @@ const ApiResponse = async (req, res) => {
|
||||
|
||||
let x = canvas.width / 2 + 80;
|
||||
let y = canvas.height - canvas.height / 2.5;
|
||||
let imageStr = imageRef.days;
|
||||
let imageStr = imageRef.sleeps;
|
||||
|
||||
//console.log(imageStr, x, y);
|
||||
ctx.lineWidth = 25;
|
||||
@@ -77,10 +77,8 @@ const ApiResponse = async (req, res) => {
|
||||
const png = canvas.toBuffer("image/png");
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
"s-maxage=0",
|
||||
"content-disposition",
|
||||
"attachment; filename=" + imageRef.days + "-sleeps.png"
|
||||
"attachment; filename=" + imageRef.sleeps + "-sleeps.png"
|
||||
);
|
||||
res.status(200).send(png);
|
||||
};
|
||||
+9
-10
@@ -2,21 +2,20 @@
|
||||
|
||||
import Image from "next/image";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import axios from "axios";
|
||||
|
||||
const FourOhFour = (props) => {
|
||||
const router = useRouter();
|
||||
|
||||
let numbDays = router.query.n;
|
||||
return (
|
||||
<div>
|
||||
<Image
|
||||
src={"/api/days/" + numbDays}
|
||||
width="940"
|
||||
height="788"
|
||||
alt="days"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("hello");
|
||||
return axios.get("/api/days/99");
|
||||
});
|
||||
|
||||
return <div>done</div>;
|
||||
};
|
||||
|
||||
export default FourOhFour;
|
||||
|
||||
Reference in New Issue
Block a user