pl-fe: feedback on event participation accept/reject
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -8,10 +8,15 @@ import Spinner from 'pl-fe/components/ui/spinner';
|
||||
import Stack from 'pl-fe/components/ui/stack';
|
||||
import AccountContainer from 'pl-fe/containers/account-container';
|
||||
import { useAcceptEventParticipationRequestMutation, useEventParticipationRequests, useRejectEventParticipationRequestMutation } from 'pl-fe/queries/events/use-event-participation-requests';
|
||||
import toast from 'pl-fe/toast';
|
||||
|
||||
const messages = defineMessages({
|
||||
authorize: { id: 'compose_event.participation_requests.authorize', defaultMessage: 'Authorize' },
|
||||
authorizeSuccess: { id: 'compose_event.participation_requests.authorize.success', defaultMessage: 'Event participation request authorized successfully' },
|
||||
authorizeFail: { id: 'compose_event.participation_requests.authorize.fail', defaultMessage: 'Failed to authorize event participation request' },
|
||||
reject: { id: 'compose_event.participation_requests.reject', defaultMessage: 'Reject' },
|
||||
rejectSuccess: { id: 'compose_event.participation_requests.reject.success', defaultMessage: 'Event participation request rejected successfully' },
|
||||
rejectFail: { id: 'compose_event.participation_requests.reject.fail', defaultMessage: 'Failed to reject event participation request' },
|
||||
});
|
||||
|
||||
interface IAccount {
|
||||
@ -36,13 +41,27 @@ const Account: React.FC<IAccount> = ({ eventId, id, participationMessage }) => {
|
||||
theme='secondary'
|
||||
size='sm'
|
||||
text={intl.formatMessage(messages.authorize)}
|
||||
onClick={() => acceptEventParticipationRequest()}
|
||||
onClick={() => acceptEventParticipationRequest(undefined, {
|
||||
onSuccess: () => {
|
||||
toast.success(messages.authorizeSuccess);
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(messages.authorizeFail);
|
||||
},
|
||||
})}
|
||||
/>
|
||||
<Button
|
||||
theme='danger'
|
||||
size='sm'
|
||||
text={intl.formatMessage(messages.reject)}
|
||||
onClick={() => rejectEventParticipationRequest()}
|
||||
onClick={() => rejectEventParticipationRequest(undefined, {
|
||||
onSuccess: () => {
|
||||
toast.success(messages.rejectSuccess);
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(messages.rejectFail);
|
||||
},
|
||||
})}
|
||||
/>
|
||||
</HStack>
|
||||
}
|
||||
|
||||
@ -548,8 +548,12 @@
|
||||
"compose_event.fields.start_time_label": "Event start date",
|
||||
"compose_event.fields.start_time_placeholder": "Event begins on…",
|
||||
"compose_event.participation_requests.authorize": "Authorize",
|
||||
"compose_event.participation_requests.authorize.fail": "Failed to authorize event participation request",
|
||||
"compose_event.participation_requests.authorize.success": "Event participation request authorized successfully",
|
||||
"compose_event.participation_requests.authorize_success": "User accepted",
|
||||
"compose_event.participation_requests.reject": "Reject",
|
||||
"compose_event.participation_requests.reject.fail": "Failed to reject event participation request",
|
||||
"compose_event.participation_requests.reject.success": "Event participation request rejected successfully",
|
||||
"compose_event.participation_requests.reject_success": "User rejected",
|
||||
"compose_event.reset_location": "Reset location",
|
||||
"compose_event.submit_success": "Your event was created",
|
||||
|
||||
Reference in New Issue
Block a user