Publish current project state

This commit is contained in:
2026-09-14 10:47:21 +08:00
parent 0dd188c46f
commit 4ad56ee9f8
186 changed files with 6289 additions and 1657 deletions
@@ -7,6 +7,7 @@ export const state = {
uiFlags: {
isFetching: false,
isCreating: false,
isUpdating: false,
isDeleting: false,
},
};
@@ -51,6 +52,18 @@ export const actions = {
}
},
async update({ commit }, { noteId, contactId, content }) {
commit(types.SET_CONTACT_NOTES_UI_FLAG, { isUpdating: true });
try {
const { data } = await ContactNotesAPI.update(contactId, noteId, content);
commit(types.EDIT_CONTACT_NOTE, { contactId, data });
} catch (error) {
throw new Error(error);
} finally {
commit(types.SET_CONTACT_NOTES_UI_FLAG, { isUpdating: false });
}
},
async delete({ commit }, { noteId, contactId }) {
commit(types.SET_CONTACT_NOTES_UI_FLAG, { isDeleting: true });
try {
@@ -82,6 +95,12 @@ export const mutations = {
const contactNotes = $state.records[contactId] || [];
$state.records[contactId] = [...contactNotes, data];
},
[types.EDIT_CONTACT_NOTE]($state, { data, contactId }) {
const contactNotes = $state.records[contactId] || [];
$state.records[contactId] = contactNotes.map(note =>
note.id === data.id ? data : note
);
},
[types.DELETE_CONTACT_NOTE]($state, { noteId, contactId }) {
const contactNotes = $state.records[contactId];
const withoutDeletedNote = contactNotes.filter(note => note.id !== noteId);