Commit ad2900f4 authored by Sandro Lutz's avatar Sandro Lutz Committed by Sandro Lutz
Browse files

Improve error message when event signup failed

parent 4338f66b
Pipeline #82881 passed with stages
in 11 minutes and 42 seconds
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { useSelector, useDispatch } from 'react-redux' import { useSelector, useDispatch } from 'react-redux'
import { Parser as HtmlToReactParser } from 'html-to-react'
import { makeStyles } from '@material-ui/styles' import { makeStyles } from '@material-ui/styles'
import { import {
Toolbar, Toolbar,
...@@ -166,7 +165,6 @@ const EventDetails = ({ eventId, ...props }) => { ...@@ -166,7 +165,6 @@ const EventDetails = ({ eventId, ...props }) => {
const { data } = event const { data } = event
const htmlToReactParser = new HtmlToReactParser()
const now = new Date() const now = new Date()
const hasOpenRegistration = const hasOpenRegistration =
data.time_register_start && data.time_register_start &&
...@@ -188,10 +186,7 @@ const EventDetails = ({ eventId, ...props }) => { ...@@ -188,10 +186,7 @@ const EventDetails = ({ eventId, ...props }) => {
// -------------------- // --------------------
// Prepare notification // Prepare notification
if (storedNotification && storedNotification.label) { if (storedNotification && storedNotification.label) {
notification = { notification = { ...storedNotification }
...storedNotification,
label: htmlToReactParser.parse(storedNotification.label),
}
} else if ( } else if (
data.time_register_start && data.time_register_start &&
now < new Date(data.time_register_start) now < new Date(data.time_register_start)
...@@ -444,10 +439,12 @@ const EventDetails = ({ eventId, ...props }) => { ...@@ -444,10 +439,12 @@ const EventDetails = ({ eventId, ...props }) => {
}) })
}) })
.catch(err => { .catch(err => {
const resp = err.response
if ( if (
err.data && resp.data &&
err.data.message && resp.data._issues &&
err.data.message.includes('blacklist') resp.data._issues.user &&
resp.data._issues.user.includes('blacklist')
) { ) {
setStoredNotification({ setStoredNotification({
severity: 'error', severity: 'error',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment