summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/FINISHED/frontend/components/Reset.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-09-14 12:18:12 -0400
committerWes Bos <wesbos@gmail.com>2018-09-14 12:18:12 -0400
commit2d145b026cfdf54a63bef0b9d6324b6785390307 (patch)
treef6c1d8f987437803a5c026e70535bf9ff244e885 /stepped-solutions/FINISHED/frontend/components/Reset.js
parent8a5825d52271d712ec7c8348447d433067e13ef2 (diff)
move finished folder
Diffstat (limited to 'stepped-solutions/FINISHED/frontend/components/Reset.js')
-rw-r--r--stepped-solutions/FINISHED/frontend/components/Reset.js84
1 files changed, 0 insertions, 84 deletions
diff --git a/stepped-solutions/FINISHED/frontend/components/Reset.js b/stepped-solutions/FINISHED/frontend/components/Reset.js
deleted file mode 100644
index a132f03..0000000
--- a/stepped-solutions/FINISHED/frontend/components/Reset.js
+++ /dev/null
@@ -1,84 +0,0 @@
-import React, { Component } from 'react';
-import { Mutation } from 'react-apollo';
-import gql from 'graphql-tag';
-import PropTypes from 'prop-types';
-import Form from './styles/Form';
-import Error from './ErrorMessage';
-import { CURRENT_USER_QUERY } from './User';
-
-const RESET_MUTATION = gql`
- mutation RESET_MUTATION($resetToken: String!, $password: String!, $confirmPassword: String!) {
- resetPassword(resetToken: $resetToken, password: $password, confirmPassword: $confirmPassword) {
- id
- email
- name
- }
- }
-`;
-
-class Reset extends Component {
- static propTypes = {
- resetToken: PropTypes.string.isRequired,
- };
- state = {
- password: '',
- confirmPassword: '',
- };
- saveToState = e => {
- this.setState({ [e.target.name]: e.target.value });
- };
- render() {
- return (
- <Mutation
- mutation={RESET_MUTATION}
- variables={{
- resetToken: this.props.resetToken,
- password: this.state.password,
- confirmPassword: this.state.confirmPassword,
- }}
- refetchQueries={[{ query: CURRENT_USER_QUERY }]}
- >
- {(reset, { error, loading, called }) => (
- <Form
- method="post"
- onSubmit={async e => {
- e.preventDefault();
- await reset();
- this.setState({ password: '', confirmPassword: '' });
- }}
- >
- <fieldset disabled={loading} aria-busy={loading}>
- <h2>Reset Your Password</h2>
- <Error error={error} />
- <label htmlFor="password">
- Password
- <input
- type="password"
- name="password"
- placeholder="password"
- value={this.state.password}
- onChange={this.saveToState}
- />
- </label>
-
- <label htmlFor="confirmPassword">
- Confirm Your Password
- <input
- type="password"
- name="confirmPassword"
- placeholder="confirmPassword"
- value={this.state.confirmPassword}
- onChange={this.saveToState}
- />
- </label>
-
- <button type="submit">Reset Your Password!</button>
- </fieldset>
- </Form>
- )}
- </Mutation>
- );
- }
-}
-
-export default Reset;