Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Fix callout share app
Browse files Browse the repository at this point in the history
  • Loading branch information
wpf500 committed Mar 15, 2024
1 parent 319b99a commit eb11fa1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/apps/share/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ app.set("views", __dirname + "/views");
async function getCalloutShareSettings(
uri: string
): Promise<JustPageSettings | undefined> {
const [slug, rest] = uri.substring("/callouts/".length).split("/", 1);
const locale = rest.split("?lang=")[1] || "default";
const parts = uri.substring("/callouts/".length).split("?");
const slug = parts[0].split("/")[0];
const locale =
parts[1]
?.split("&")
.map((q) => q.split("="))
.find(([k]) => k === "lang")?.[1] || "default";

console.log("slug", slug, "locale", locale);

const callout = await createQueryBuilder(Callout, "c")
.leftJoinAndSelect("c.variants", "v", "v.locale = :locale", { locale })
.innerJoinAndSelect("c.variants", "v", "v.name = :locale", { locale })
.where("c.slug = :slug", { slug })
.getOne();

Expand Down

0 comments on commit eb11fa1

Please sign in to comment.