fixed wrong env var, added base maps
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user