Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add member link in toast message after member creation #1681

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions frontend/src/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ const en = {
title: 'Contacts',
},
create: {
success: 'Contact successfully saved',
success: 'Contact added successfully',
error: 'There was an error creating the contact',
message: 'View contact',
},
update: {
success: 'Contact successfully saved',
success: 'Contact edited successfully',
error: 'There was an error updating the contact',
},
destroy: {
Expand Down
28 changes: 25 additions & 3 deletions frontend/src/shared/store/actions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { h } from 'vue';
import { attributesAreDifferent } from '@/shared/filter/helpers/different-util';
import { router } from '@/router';
import Errors from '@/shared/error/errors';
Expand Down Expand Up @@ -113,9 +114,30 @@ export default (moduleName, moduleService = null) => {
);
commit('CREATE_SUCCESS', response);

Message.success(
i18n(`entities.${moduleName}.create.success`),
);
if (moduleName === 'member') {
const contactId = response.id;
const successMessageAction = i18n(`entities.${moduleName}.create.message`);
const message = h(
'el-button',
{
class: 'btn btn--xs btn--bordered !h-6',
onClick: () => {
router.push({
name: 'memberView',
params: { id: contactId },
});
Message.closeAll();
},
},
successMessageAction,
);

Message.success(i18n(`entities.${moduleName}.create.success`), {
message,
});
} else {
Message.success(i18n(`entities.${moduleName}.create.success`));
}

return response;
} catch (error) {
Expand Down
Loading