X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fresults%2FReportForm.js;h=9940171f344f676edf3ce1d89388e4f789be5be7;hb=537b998e8059c56e3a20ee2a89d42c3bbfbb80b8;hp=942869da7123c36b160ef76368c3877f2032bbee;hpb=3e970c52e6a46cf9db4f69c5bec9102da53c0744;p=alttp.git diff --git a/resources/js/components/results/ReportForm.js b/resources/js/components/results/ReportForm.js index 942869d..9940171 100644 --- a/resources/js/components/results/ReportForm.js +++ b/resources/js/components/results/ReportForm.js @@ -8,7 +8,7 @@ import toastr from 'toastr'; import LargeCheck from '../common/LargeCheck'; import laravelErrorsToFormik from '../../helpers/laravelErrorsToFormik'; -import { findResult } from '../../helpers/Participant'; +import { findResult } from '../../helpers/User'; import { formatTime, parseTime } from '../../helpers/Result'; import i18n from '../../i18n'; import yup from '../../schema/yup'; @@ -121,16 +121,16 @@ export default withFormik({ displayName: 'ReportForm', enableReinitialize: true, handleSubmit: async (values, actions) => { - const { comment, forfeit, participant_id, round_id, time } = values; + const { comment, forfeit, round_id, time, user_id } = values; const { setErrors } = actions; const { onCancel } = actions.props; try { await axios.post('/api/results', { comment, forfeit, - participant_id, round_id, time: parseTime(time) || 0, + user_id, }); toastr.success(i18n.t('results.reportSuccess')); if (onCancel) { @@ -143,14 +143,14 @@ export default withFormik({ } } }, - mapPropsToValues: ({ participant, round }) => { - const result = findResult(participant, round); + mapPropsToValues: ({ round, user }) => { + const result = findResult(user, round); return { comment: result && result.comment ? result.comment : '', forfeit: result ? !!result.forfeit : false, - participant_id: participant.id, round_id: round.id, time: result && result.time ? formatTime(result) : '', + user_id: user.id, }; }, validationSchema: yup.object().shape({