Feat/navigate to signup if email does not exist (#540)

* Add userExists route

* Fix demo mode for login

* Improve sign in/up flow

* Remove redundant password length constraint

* Fix test
This commit is contained in:
Emilien Chauvet
2023-07-08 15:02:39 -07:00
committed by GitHub
parent 36ace6cc03
commit 9cd5f7c057
10 changed files with 123 additions and 20 deletions

View File

@ -2286,6 +2286,7 @@ export type PipelineWhereUniqueInput = {
export type Query = {
__typename?: 'Query';
checkUserExists: UserExists;
clientConfig: ClientConfig;
currentUser: User;
currentWorkspace: Workspace;
@ -2299,6 +2300,11 @@ export type Query = {
};
export type QueryCheckUserExistsArgs = {
email: Scalars['String'];
};
export type QueryFindManyCommentThreadsArgs = {
cursor?: InputMaybe<CommentThreadWhereUniqueInput>;
distinct?: InputMaybe<Array<CommentThreadScalarFieldEnum>>;
@ -2498,6 +2504,11 @@ export type UserCreateWithoutWorkspaceMemberInput = {
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type UserExists = {
__typename?: 'UserExists';
exists: Scalars['Boolean'];
};
export type UserOrderByWithRelationInput = {
avatarUrl?: InputMaybe<SortOrder>;
comments?: InputMaybe<CommentOrderByRelationAggregateInput>;
@ -2789,6 +2800,13 @@ export type CreateEventMutationVariables = Exact<{
export type CreateEventMutation = { __typename?: 'Mutation', createEvent: { __typename?: 'Analytics', success: boolean } };
export type CheckUserExistsQueryVariables = Exact<{
email: Scalars['String'];
}>;
export type CheckUserExistsQuery = { __typename?: 'Query', checkUserExists: { __typename?: 'UserExists', exists: boolean } };
export type ChallengeMutationVariables = Exact<{
email: Scalars['String'];
password: Scalars['String'];
@ -3116,6 +3134,41 @@ export function useCreateEventMutation(baseOptions?: Apollo.MutationHookOptions<
export type CreateEventMutationHookResult = ReturnType<typeof useCreateEventMutation>;
export type CreateEventMutationResult = Apollo.MutationResult<CreateEventMutation>;
export type CreateEventMutationOptions = Apollo.BaseMutationOptions<CreateEventMutation, CreateEventMutationVariables>;
export const CheckUserExistsDocument = gql`
query CheckUserExists($email: String!) {
checkUserExists(email: $email) {
exists
}
}
`;
/**
* __useCheckUserExistsQuery__
*
* To run a query within a React component, call `useCheckUserExistsQuery` and pass it any options that fit your needs.
* When your component renders, `useCheckUserExistsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useCheckUserExistsQuery({
* variables: {
* email: // value for 'email'
* },
* });
*/
export function useCheckUserExistsQuery(baseOptions: Apollo.QueryHookOptions<CheckUserExistsQuery, CheckUserExistsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<CheckUserExistsQuery, CheckUserExistsQueryVariables>(CheckUserExistsDocument, options);
}
export function useCheckUserExistsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<CheckUserExistsQuery, CheckUserExistsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<CheckUserExistsQuery, CheckUserExistsQueryVariables>(CheckUserExistsDocument, options);
}
export type CheckUserExistsQueryHookResult = ReturnType<typeof useCheckUserExistsQuery>;
export type CheckUserExistsLazyQueryHookResult = ReturnType<typeof useCheckUserExistsLazyQuery>;
export type CheckUserExistsQueryResult = Apollo.QueryResult<CheckUserExistsQuery, CheckUserExistsQueryVariables>;
export const ChallengeDocument = gql`
mutation Challenge($email: String!, $password: String!) {
challenge(email: $email, password: $password) {