<commit_before>import React from 'react';
import { reduxForm, Field } from 'redux-form';
import { Form, Button, TextInput } from 'app/components/Form';

export type Props = {
  handleSubmit: () => void,
  username: string,
  updateUser: () => Promise<*>,
  invalid: boolean,
  pristine: boolean,
  submitting: boolean
};

const UpdateAllergies = ({
  handleSubmit,
  username,
  updateUser,
  invalid,
  pristine,
  submitting
}: Props) => (
  <Form
    onSubmit={handleSubmit(({ allergies }) =>
      updateUser(
        {
          username,
          allergies
        },
        { noRedirect: true }
      )
    )}
    style={{ marginBottom: '20px' }}
  >
    <div>
      <Field
        label="Dine allergier"
        placeholder="Ingen"
        name="allergies"
        component={TextInput.Field}
      />
      <Button submit disabled={invalid | pristine | submitting}>
        Oppdater allergier
      </Button>
    </div>
  </Form>
);

export default reduxForm({ form: 'UpdateAllergies' })(UpdateAllergies);<commit_msg>Change naming of allergies<commit_after>import React from 'react';
import { reduxForm, Field } from 'redux-form';
import { Form, Button, TextInput } from 'app/components/Form';

export type Props = {
  handleSubmit: () => void,
  username: string,
  updateUser: () => Promise<*>,
  invalid: boolean,
  pristine: boolean,
  submitting: boolean
};

const UpdateAllergies = ({
  handleSubmit,
  username,
  updateUser,
  invalid,
  pristine,
  submitting
}: Props) => (
  <Form
    onSubmit={handleSubmit(({ allergies }) =>
      updateUser(
        {
          username,
          allergies
        },
        { noRedirect: true }
      )
    )}
    style={{ marginBottom: '20px' }}
  >
    <div>
      <Field
        label="Allergier eller preferanser"
        placeholder="Ingen"
        name="allergies"
        component={TextInput.Field}
      />
      <Button submit disabled={invalid | pristine | submitting}>
        Oppdater
      </Button>
    </div>
  </Form>
);

export default reduxForm({ form: 'UpdateAllergies' })(UpdateAllergies);
{'fraction_non_alphanumeric': 0.13320463320463322, 'fraction_numerical': 0.0019305019305019305, 'mean_word_length': 2.636842105263158, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2359671', 'n_tokens_mistral': 651, 'n_tokens_neox': 638, 'n_words': 148}