fixed wrong env var, added base maps

This commit is contained in:
PxlLoewe
2025-06-01 09:00:59 -07:00
parent cded757b9f
commit e73f19d9e8
11 changed files with 113651 additions and 24 deletions

View File

@@ -5,11 +5,10 @@ import { verify } from "jsonwebtoken";
export const PUT = async (req: Request) => {
const session = await getServerSession();
const token = req.headers.get("authorization")?.split(" ")[1];
if (!token)
return Response.json({ message: "Missing token" }, { status: 401 });
if (!token) return Response.json({ message: "Missing token" }, { status: 401 });
const payload = await new Promise<User>((resolve, reject) => {
verify(token, process.env.NEXTAUTH_HUB_SECRET as string, (err, decoded) => {
verify(token, process.env.AUTH_HUB_SECRET as string, (err, decoded) => {
if (err) {
reject(err);
} else {
@@ -18,8 +17,7 @@ export const PUT = async (req: Request) => {
});
});
if (!session && !payload)
return Response.json({ message: "Unauthorized" }, { status: 401 });
if (!session && !payload) return Response.json({ message: "Unauthorized" }, { status: 401 });
const userId = session?.user.id || payload.id;
const { position, h145 } = (await req.json()) as {
@@ -47,10 +45,7 @@ export const PUT = async (req: Request) => {
});
if (!activeAircraft) {
return Response.json(
{ message: "No active aircraft found" },
{ status: 400 },
);
return Response.json({ message: "No active aircraft found" }, { status: 400 });
}
const positionLog = await prisma.positionLog.create({
data: {