Skip to content

Commit

Permalink
Merge pull request #4 from jackmerrill/feat/redirect
Browse files Browse the repository at this point in the history
Feat/redirect
  • Loading branch information
jackmerrill authored Jul 16, 2022
2 parents 387b9d8 + d040eb4 commit d2f105f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/astro-forms/Form.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { GenericTheme } from "./Themes";
import { Theme, FormSchema } from "./types";
import { flatten } from "./util";
const { schema, action, method, classes, theme, data } = Astro.props as {
const { schema, action, method, classes, theme, data, redirect } = Astro.props as {
schema: FormSchema;
action: string;
method: "post" | "get";
classes: string;
theme: Theme;
data: Record<string, any>
data: Record<string, any>;
redirect: string;
};
const components: Theme = {
Expand All @@ -25,5 +26,8 @@ const flattenedData = flatten(data);
---

<form action={action} method={method} class={classes} enctype="multipart/form-data">
{redirect && (
<input type="hidden" name="redirect" hidden value={redirect} />
)}
<components.Generic schema={schema} components={components} data={flattenedData} />
</form>
2 changes: 1 addition & 1 deletion packages/astro-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro-forms",
"version": "1.0.9",
"version": "1.0.10",
"description": "Forms in Astro, made easy.",
"main": "index.mjs",
"homepage": "https://github.com/jackmerrill/astroforms#readme",
Expand Down

0 comments on commit d2f105f

Please sign in to comment.