generated from vtex-sites/base.store
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Newsletter form and useNewsletter hook (#134)
* Add newsletter form * Add useNewsletter hook * Update CHANGELOG * Change component name * Use newsletter section * Remove newsletter from footer * Remove from home page * Update api version * Apply changes after reviews
- Loading branch information
1 parent
afeb30e
commit 2b38bba
Showing
7 changed files
with
105 additions
and
21 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
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
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
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,31 @@ | ||
import { gql } from '@faststore/graphql-utils' | ||
|
||
import type { | ||
SubscribeToNewsletterMutation as Mutation, | ||
SubscribeToNewsletterMutationVariables as Variables, | ||
} from '../../../@generated/graphql/index' | ||
import { useLazyQuery } from '../graphql/useLazyQuery' | ||
|
||
export const mutation = gql` | ||
mutation SubscribeToNewsletter($data: IPersonNewsletter!) { | ||
subscribeToNewsletter(data: $data) { | ||
id | ||
} | ||
} | ||
` | ||
|
||
export const useNewsletter = () => { | ||
const [subscribeUser, { data, error, isValidating: loading }] = useLazyQuery< | ||
Mutation, | ||
Variables | ||
>(mutation, { | ||
data: { name: '', email: '' }, | ||
}) | ||
|
||
return { | ||
subscribeUser, | ||
data, | ||
error, | ||
loading, | ||
} | ||
} |
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
2b38bba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
gatsby-store-storybook – ./
gatsby-store-storybook-faststore.vercel.app
gatsby-store-pi.vercel.app
gatsby-store-storybook-git-main-faststore.vercel.app