-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(create-drupal-decoupled) Add support to preview (#79)
* 🐛 fix(create-drupal-decoupled) Add typename to support redirects * ✨ feat(create-drupal-decoupled) Add calculate path to scaffolding files * ✨ feat(create-drupal-decoupled) Add support to previews using calculate paths
- Loading branch information
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@octahedroid/create-drupal-decoupled": minor | ||
--- | ||
|
||
Fix redirects and add calculate path to support redirects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/create-drupal-decoupled/src/templates/remix-graphql/calculate-path.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
interface CalculatePathArgs { | ||
path: string | undefined; | ||
url: Request['url']; | ||
} | ||
|
||
export const calculatePath = ({ path = "/", url }: CalculatePathArgs): string => { | ||
if (path.startsWith("node/preview")) { | ||
const { searchParams } = new URL(url); | ||
if (searchParams.has("token")) { | ||
return `${path}?token=${searchParams.get("token")}`; | ||
} | ||
} | ||
|
||
return path; | ||
} |