forked from harness/canary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update signin, signup, otp and new password pages
- Loading branch information
1 parent
d1186c6
commit 27d173e
Showing
47 changed files
with
6,485 additions
and
3,329 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FC } from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
import { getUser, useOnLoginMutation } from '@harnessio/code-service-client' | ||
import { SignInData, SignInPage } from '@harnessio/ui/views' | ||
|
||
import { useAppContext } from '../framework/context/AppContext' | ||
|
||
export const SignIn: FC = () => { | ||
const navigate = useNavigate() | ||
const { setCurrentUser } = useAppContext() | ||
const { | ||
mutate: login, | ||
isLoading, | ||
error | ||
} = useOnLoginMutation( | ||
{ queryParams: { include_cookie: true } }, | ||
{ | ||
onSuccess: () => { | ||
getUser({}) | ||
.then(response => { | ||
setCurrentUser(response.body) | ||
}) | ||
.catch(_e => { | ||
// Ignore/toast error | ||
}) | ||
navigate('/') // Redirect to Home page | ||
} | ||
} | ||
) | ||
|
||
return ( | ||
<SignInPage | ||
isLoading={isLoading} | ||
handleSignIn={(data: SignInData) => { | ||
login({ | ||
body: { | ||
login_identifier: data.email, | ||
password: data.password | ||
} | ||
}) | ||
}} | ||
error={error?.message} | ||
/> | ||
) | ||
} |
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,35 @@ | ||
import { useEffect } from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
import { useOnRegisterMutation } from '@harnessio/code-service-client' | ||
import { SignUpData, SignUpPage } from '@harnessio/ui/views' | ||
|
||
export const SignUp: React.FC = () => { | ||
const navigate = useNavigate() | ||
|
||
const { | ||
mutate: register, | ||
isLoading, | ||
isSuccess, | ||
error | ||
} = useOnRegisterMutation({ queryParams: { include_cookie: true } }) | ||
|
||
useEffect(() => { | ||
if (isSuccess) { | ||
navigate('/') // Redirect to Home page | ||
} | ||
}, [isSuccess]) | ||
|
||
const handleSignUp = (data: SignUpData) => { | ||
register({ | ||
body: { | ||
email: data.email, | ||
password: data.password, | ||
uid: data.userId, | ||
display_name: data.userId | ||
} | ||
}) | ||
} | ||
|
||
return <SignUpPage isLoading={isLoading} handleSignUp={handleSignUp} error={error?.message} /> | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.