-
Notifications
You must be signed in to change notification settings - Fork 3
INTERMEDIO - feature/#73-Funcionalidad-reset-password-en-Editar-Usuario-a-mock-server #75
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
Open
manugallegob
wants to merge
4
commits into
main
Choose a base branch
from
feature/#73-Funcionalidad-reset-password-en-Editar-Usuario-a-mock-server
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
17955fa
feature edit reset password ok
manugallegob 1fbec84
feat: implement password reset functionality and integrate snackbar n…
manudous 8eeafbf
Merge branch 'main' into feature/#73-Funcionalidad-reset-password-en-…
manudous c6577cb
creación de endpoint para reset password
manugallegob 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
7 changes: 7 additions & 0 deletions
7
src/modules/users/edit-reset-password/api/edit-reset-password.api.ts
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,7 @@ | ||
import axios from 'axios'; | ||
|
||
export const updatePassword = async (password: string, id: string): Promise<boolean> => { | ||
const response = await axios.put<boolean>(`/api/user/${id}`, { contraseña: password }); | ||
|
||
return response.data; | ||
}; |
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 @@ | ||
export * from './edit-reset-password.api'; |
25 changes: 25 additions & 0 deletions
25
src/modules/users/edit-reset-password/components/alerts-reset-password.componet.tsx
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,25 @@ | ||
import React from 'react'; | ||
import { Alert } from '@mui/material'; | ||
import CheckIcon from '@mui/icons-material/Check'; | ||
|
||
interface Props { | ||
handleClose: () => void; | ||
} | ||
|
||
export const SuccessAlertResetPassword: React.FC<Props> = props => { | ||
const { handleClose } = props; | ||
return ( | ||
<Alert icon={<CheckIcon fontSize="inherit" />} severity="success" onClose={handleClose}> | ||
Contraseña reseteada exitosamente. | ||
</Alert> | ||
); | ||
}; | ||
|
||
export const ErrorAlertResetPassword: React.FC<Props> = props => { | ||
const { handleClose } = props; | ||
return ( | ||
<Alert icon={<CheckIcon fontSize="inherit" />} severity="error" onClose={handleClose}> | ||
Error: La contraseña no ha podido ser cambiada. Intente de nuevo. | ||
</Alert> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './confirm-reset-dialog.component'; | ||
export * from './alerts-reset-password.componet'; |
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
7 changes: 3 additions & 4 deletions
7
src/modules/users/edit-reset-password/edit-reset-password.pod.tsx
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 |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import React from 'react'; | ||
import { EditResetPasswordComponent } from './edit-reset-password.component'; | ||
|
||
// TO DO: prop id se usará cuando el endpoint de reseteo de clave esté listo | ||
interface Props { | ||
id: string; | ||
} | ||
|
||
export const EditResetPassword: React.FC<Props> = () => { | ||
// const { id } = props; | ||
export const EditResetPassword: React.FC<Props> = props => { | ||
const { id } = props; | ||
return ( | ||
<> | ||
<EditResetPasswordComponent /> | ||
<EditResetPasswordComponent userId={id} /> | ||
</> | ||
); | ||
}; |
32 changes: 32 additions & 0 deletions
32
src/modules/users/edit-reset-password/edit-reset-password.query.hook.ts
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,32 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { updatePassword } from './api'; | ||
|
||
interface ParamsMutationPassword { | ||
password: string; | ||
id: string; | ||
} | ||
|
||
interface UseSavePasswordMutationResult { | ||
savePassword: (params: ParamsMutationPassword) => void; | ||
isPending: boolean; | ||
isSuccess: boolean; | ||
isError: boolean; | ||
} | ||
|
||
export const useUpdateUserPasswordMutation = (): UseSavePasswordMutationResult => { | ||
const { | ||
mutate: savePassword, | ||
isPending, | ||
isSuccess, | ||
isError, | ||
} = useMutation({ | ||
mutationFn: ({ password, id }: ParamsMutationPassword) => updatePassword(password, id), | ||
}); | ||
|
||
return { | ||
savePassword, | ||
isPending, | ||
isSuccess, | ||
isError, | ||
}; | ||
}; |
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.
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.
The file name 'alerts-reset-password.componet.tsx' appears to contain a typographical error. Consider renaming it to 'alerts-reset-password.component.tsx'.
Copilot uses AI. Check for mistakes.