-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from Callgent/confirm-email
feat: email registration
- Loading branch information
Showing
18 changed files
with
177 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"label": "Advanced Topics", | ||
"position": 3, | ||
"position": 4, | ||
"link": { | ||
"type": "generated-index" | ||
} | ||
|
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,47 @@ | ||
import useIsBrowser from '@docusaurus/useIsBrowser'; | ||
import styles from './index.module.css'; | ||
import { DocType } from '@site/src/types/user'; | ||
import React, { useRef, useState } from 'react'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
|
||
const CreateCallgent = () => { | ||
const isBrowser = useIsBrowser(); | ||
if (!isBrowser) { | ||
return null; | ||
} | ||
const { sendConfirmEmail } = require('@site/src/store/thunk'); | ||
const [state, setState] = useState(null); | ||
const dispatch = useDispatch(); | ||
const onEmailSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
const formData = new FormData(event.currentTarget); | ||
const email = formData.get('email') as string; | ||
dispatch(sendConfirmEmail({ email })) | ||
.then((req) => { | ||
if (req.payload !== "Failed to send confirmation email") { | ||
setState('success'); | ||
} else { | ||
setState('error'); | ||
} | ||
}); | ||
}; | ||
return ( | ||
<> | ||
<form onSubmit={(e) => onEmailSubmit(e)} className={styles.form}> | ||
<input | ||
type="email" | ||
name="email" | ||
required | ||
placeholder="Enter your email to register" | ||
className='input col col--4 margin--sm table-of-contents' | ||
/> | ||
<button className='button col col--3 margin--sm button--info button--secondary'> | ||
Send Email | ||
</button> | ||
</form> | ||
{state === 'success' && <div className="text--success margin--sm">Please check your email to confirm registration!</div>} | ||
{state === 'error' && <div className="text--danger margin--sm">Failed to send confirmation email. Please try again later.</div>} | ||
</> | ||
); | ||
}; | ||
export default CreateCallgent; |
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,8 @@ | ||
{ | ||
"label": "User as a Service", | ||
"position": 3, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Now, let's encapsulate a user as a REST-API service. By default, the user may respond to invocations by email. And user can respond from Slack channels and other scenarios easily." | ||
} | ||
} |
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,6 @@ | ||
--- | ||
sidebar_position: 1 | ||
title: Define the user API | ||
description: Callgent is yet another AI programming tool besides Copilot, UI generator, and bug fixer, etc. | ||
keywords: [user as a service] | ||
--- |
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,6 @@ | ||
--- | ||
sidebar_position: 2 | ||
title: Import API definition into Callgent | ||
description: . | ||
keywords: [user as a service] | ||
--- |
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,6 @@ | ||
--- | ||
sidebar_position: 3 | ||
title: Invoke the User Callgent by REST API | ||
description: . | ||
keywords: [user as a service] | ||
--- |
6 changes: 6 additions & 0 deletions
6
docs/user-as-a-service/user-responds-through-other-channels.md
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,6 @@ | ||
--- | ||
sidebar_position: 4 | ||
title: User responds through other channels | ||
description: . | ||
keywords: [user as a service] | ||
--- |
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
Oops, something went wrong.