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
fragment RegularUserResponse on UserResponse { | |
errors { | |
...RegularError | |
} | |
user { | |
...RegularUser | |
} | |
} |
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
fragment RegularError on FieldError { | |
id | |
username | |
} |
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
mutation ChangePassword($token: String!, $newPassword: String!) { | |
changePassword(token: $token, newPassword: $newPassword) { | |
errors { | |
...RegularError | |
} | |
user { | |
...RegularUser | |
} | |
} | |
} |
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
@Mutation(() => UserResponse) | |
async changePassword( | |
@Arg("token") token: string, | |
@Arg("newPassword") newPassword: string, | |
@Ctx() { em, redis, req }: RedditDbContext | |
): Promise<UserResponse> { | |
// first validate the password | |
if (newPassword.length <= 2) { | |
return { | |
errors: [ |
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
return ( | |
<Wrapper variant="small"> | |
<Formik | |
initialValues={{ newPassword: "" }} | |
onSubmit={async (values, { setErrors }) => {}} | |
> | |
{({ isSubmitting }) => ( | |
<Form> | |
<Box mt={4}> | |
<InputField |
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
ChangePassword.getInitialProps = ({query}) => { | |
return { | |
token: query.token as string | |
} | |
} |
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
import { NextPage } from "next"; | |
import React from "react"; | |
const ChangePassword: NextPage<{ token: string }> = ({ token }) => { | |
return <div></div>; | |
}; |
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
mutation { | |
forgotPassword(email:"rasika@rasikag.com") | |
} |
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
public class Tag | |
{ | |
public int Id { get; set; } | |
public string Text { get; set; } | |
public ICollection<PostTag> PostTags { get; set; } | |
} |
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
public class Post | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public ICollection<PostTag> PostTags { get; set; } | |
} |