-
Notifications
You must be signed in to change notification settings - Fork 0
Add auth API connections #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5b7cf87
Add example.env
jzgom067 4a1a848
Update example.env
jzgom067 c3aa837
Add setup for local API testing
jzgom067 3fd594d
Create API error format util function
jzgom067 cd077df
Add login API functionality
jzgom067 9cb9ecd
Add login restriction
jzgom067 0899531
Fix login button functionality
jzgom067 8fd8bcc
Add sign up API functionality
jzgom067 7a5ae7e
Add resend verification email API functionality
jzgom067 943382d
Add verify email API functionality
jzgom067 9cc83d4
Add forgot password API functionality
jzgom067 e21ec07
Add reset password API functionality
jzgom067 d0509c0
Add logout button to dashboard page
jzgom067 4e9349e
Add logout API functionality
jzgom067 add88a7
Remove empty else block
jzgom067 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -39,3 +39,5 @@ yarn-error.log* | |
| # typescript | ||
| *.tsbuildinfo | ||
| next-env.d.ts | ||
|
|
||
| certificates | ||
This file contains hidden or 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 hidden or 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,36 @@ | ||
| function snakeToTitleCase(str: string): string { | ||
| return str | ||
| .split("_") | ||
| .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) | ||
| .join(" "); | ||
| } | ||
|
|
||
| export default function formatApiError(errors: any): string { | ||
| let errorMessage = ""; | ||
| let generalMessage = ""; | ||
| errors = errors.error; | ||
jzgom067 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (errors.general) { | ||
| generalMessage = errors.general[0]; | ||
| } | ||
|
|
||
| for (const field in errors) { | ||
| if (field !== "general" && Array.isArray(errors[field])) { | ||
| for (const msg of errors[field]) { | ||
| const fieldTitle = snakeToTitleCase(field); | ||
| errorMessage += `${fieldTitle}: ${msg}\n`; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (errorMessage) { | ||
| if (generalMessage) { | ||
| return generalMessage + "\n" + errorMessage.trim(); | ||
| } | ||
| return errorMessage.trim(); | ||
| } else if (generalMessage) { | ||
| return generalMessage; | ||
| } | ||
|
|
||
| return "An unknown error has occurred."; | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.