Update logging
This commit is contained in:
parent
def602c05e
commit
810a333429
39 changed files with 85 additions and 139 deletions
|
|
@ -69,19 +69,17 @@ export const getServerSideProps: GetServerSideProps = async (
|
|||
});
|
||||
});
|
||||
}
|
||||
console.log({ query });
|
||||
const dataResponse = await client.search({
|
||||
index: "demo_data",
|
||||
size: 200,
|
||||
body: { query },
|
||||
});
|
||||
console.log({ dataResponse });
|
||||
res.props.data = dataResponse.body.hits.hits.map((hit) => ({
|
||||
id: hit._id,
|
||||
...hit._source,
|
||||
}));
|
||||
console.log({ data: res.props.data });
|
||||
console.log(res.props.data[0]);
|
||||
|
||||
|
||||
|
||||
return res;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,20 +22,17 @@ export const authOptions: NextAuthOptions = {
|
|||
Credentials({
|
||||
name: "Link",
|
||||
credentials: {
|
||||
authToken: { label: "AuthToken", type: "text", },
|
||||
authToken: { label: "AuthToken", type: "text" },
|
||||
},
|
||||
async authorize(credentials, req) {
|
||||
const { headers } = req;
|
||||
console.log({ headers });
|
||||
const leafcutterUser = headers?.["x-leafcutter-user"];
|
||||
const authToken = credentials?.authToken;
|
||||
|
||||
if (!leafcutterUser || leafcutterUser.trim() === "") {
|
||||
console.log("no leafcutter user");
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log({ authToken });
|
||||
return null;
|
||||
/*
|
||||
try {
|
||||
|
|
@ -48,14 +45,13 @@ export const authOptions: NextAuthOptions = {
|
|||
|
||||
return user;
|
||||
} catch (e) {
|
||||
console.log({ e });
|
||||
console.error({ e });
|
||||
}
|
||||
|
||||
return null;
|
||||
*/
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
}),
|
||||
],
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
/*
|
||||
|
|
@ -77,4 +73,3 @@ export const authOptions: NextAuthOptions = {
|
|||
}
|
||||
},*/
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -302,8 +302,7 @@ export const updateUserVisualization = async (
|
|||
body,
|
||||
});
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log({ e });
|
||||
console.error({ e });
|
||||
}
|
||||
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export const GET = async (req: NextRequest) => {
|
||||
const validDomains = "localhost";
|
||||
console.log({ req });
|
||||
const validDomains = "localhost";
|
||||
|
||||
return NextResponse.json({ response: "ok" });
|
||||
return NextResponse.json({ response: "ok" });
|
||||
};
|
||||
|
||||
export const POST = async (req: NextRequest) => {
|
||||
const validDomains = "localhost";
|
||||
console.log({ req });
|
||||
const validDomains = "localhost";
|
||||
|
||||
return NextResponse.json({ response: "ok" });
|
||||
return NextResponse.json({ response: "ok" });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@ import { NextResponse } from "next/server";
|
|||
import { getTrends } from "app/_lib/opensearch";
|
||||
|
||||
export const GET = async () => {
|
||||
const results = await getTrends(5);
|
||||
console.log({ results });
|
||||
const results = await getTrends(5);
|
||||
|
||||
NextResponse.json(results);
|
||||
NextResponse.json(results);
|
||||
};
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const dynamic = "force-dynamic";
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ export const POST = async (req: NextRequest) => {
|
|||
rejectUnauthorized: false,
|
||||
},
|
||||
headers: {
|
||||
authorization
|
||||
}
|
||||
authorization,
|
||||
},
|
||||
});
|
||||
|
||||
const succeeded = [];
|
||||
|
|
@ -28,11 +28,15 @@ export const POST = async (req: NextRequest) => {
|
|||
const country = ticket.country[0] ?? "none";
|
||||
// @ts-expect-error
|
||||
const translatedCountry = taxonomy.country[country]?.display ?? "none";
|
||||
const countryDetails: any = unRegions.find((c) => c.name === translatedCountry);
|
||||
const countryDetails: any = unRegions.find(
|
||||
(c) => c.name === translatedCountry,
|
||||
);
|
||||
const augmentedTicket = {
|
||||
...ticket,
|
||||
region: countryDetails['sub-region']?.toLowerCase().replace(" ", "-") ?? null,
|
||||
continent: countryDetails.region?.toLowerCase().replace(" ", "-") ?? null,
|
||||
region:
|
||||
countryDetails["sub-region"]?.toLowerCase().replace(" ", "-") ?? null,
|
||||
continent:
|
||||
countryDetails.region?.toLowerCase().replace(" ", "-") ?? null,
|
||||
};
|
||||
const out = await client.create({
|
||||
id: uuid(),
|
||||
|
|
@ -40,10 +44,9 @@ export const POST = async (req: NextRequest) => {
|
|||
refresh: true,
|
||||
body: augmentedTicket,
|
||||
});
|
||||
console.log(out);
|
||||
succeeded.push(id);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
console.error(e);
|
||||
failed.push(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,4 +55,3 @@ export const POST = async (req: NextRequest) => {
|
|||
|
||||
return NextResponse.json(results);
|
||||
};
|
||||
|
||||
|
|
|
|||
2
apps/leafcutter/next-env.d.ts
vendored
2
apps/leafcutter/next-env.d.ts
vendored
|
|
@ -3,4 +3,4 @@
|
|||
/// <reference types="next/navigation-types/compat/navigation" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@ const withAuthInfo =
|
|||
const requestSignature = req.query.signature;
|
||||
const url = new URL(req.headers.referer as string);
|
||||
const referrerSignature = url.searchParams.get("signature");
|
||||
|
||||
console.log({ requestSignature, referrerSignature });
|
||||
const isAppPath = !!req.url?.startsWith("/app");
|
||||
const isResourcePath = !!req.url?.match(/\/(api|app|bootstrap|3961|ui|translations|internal|login|node_modules)/);
|
||||
const isResourcePath = !!req.url?.match(
|
||||
/\/(api|app|bootstrap|3961|ui|translations|internal|login|node_modules)/,
|
||||
);
|
||||
|
||||
if (requestSignature && isAppPath) {
|
||||
console.log("Has Signature");
|
||||
console.info("Has Signature");
|
||||
}
|
||||
|
||||
if (referrerSignature && isResourcePath) {
|
||||
console.log("Has Signature");
|
||||
console.info("Has Signature");
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue