Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #45 from exortme1ster/feature/redesign-reset-password
Browse files Browse the repository at this point in the history
Feature/redesign reset password
  • Loading branch information
nmashchenko committed Jul 10, 2023
2 parents 7f106b3 + 961e391 commit 7521e5a
Show file tree
Hide file tree
Showing 45 changed files with 1,052 additions and 1,126 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
Binary file added client/public/favicon.ico
Binary file not shown.
21 changes: 16 additions & 5 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>Teameights - Find your first pet project!</title>
<meta
name="description"
content="Web site created using create-react-app"
content="Got an interesting idea for the project but no team? No worries, teameights is here!"
key="desc"
/>
<meta
property="og:title"
content="Teameights - Find your first pet project!"
/>
<meta
property="og:description"
content="Got an interesting idea for the project but no team? No worries, teameights is here!"
/>
<meta
property="og:image"
content="https://i.ibb.co/y8MRSbY/Logo-T8-S-image.png"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />

<style>
body {
Expand Down
27 changes: 0 additions & 27 deletions client/src/api/endpoints/reset.js

This file was deleted.

33 changes: 33 additions & 0 deletions client/src/api/hooks/auth/useResetPassword.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import ROUTES from '../../../constants/routes'
import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

const { api } = http

export const useResetPasssword = (successHandler) => {
const navigate = useNavigate()

const updateUserPassword = async (email) => {
return await api.get(`/auth/reset-password/${email}`)
}

return useMutation(updateUserPassword, {
mutationKey: 'updateUserPassword',
onSuccess: async () => {
if (successHandler) {
successHandler()
}

navigate(ROUTES.confirmEmail, {
replace: true,
})
},
onError: (error) => {
// set error message
errorToaster(error, 'top-center')
},
})
}
41 changes: 41 additions & 0 deletions client/src/api/hooks/auth/useUpdatePassword.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useMutation, useQueryClient } from 'react-query'
import { useNavigate } from 'react-router-dom'

import ROUTES from '../../../constants/routes'
import http from '../../../http'
import { errorToaster } from '../../../shared/components/Toasters/Error.toaster'

const { api } = http

export const useUpdatePassword = (successHandler) => {
const navigate = useNavigate()

const updateUserPassword = async ({ email, token, password }) => {
return await api.post(`/auth/update-password`, { email, token, password })
}

return useMutation(updateUserPassword, {
mutationKey: 'updateUserPassword',
onSuccess: async () => {
if (successHandler) {
successHandler()
}

navigate(ROUTES.login, {
replace: true,
})
},
onError: (error) => {
// set error message
errorToaster(error, 'top-center')

if (error?.response?.status === 403) {
setTimeout(() => {
navigate(ROUTES.login, {
replace: true,
})
}, 1500)
}
},
})
}
24 changes: 24 additions & 0 deletions client/src/assets/BigSideLogo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7521e5a

Please sign in to comment.