Feature: Add/Edit conversation labels (#488)

Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
Nithin David Thomas
2020-02-16 15:46:26 +05:30
committed by GitHub
parent 77473dc2aa
commit e61ba95cf7
31 changed files with 863 additions and 323 deletions

View File

@@ -6,6 +6,8 @@ const state = {
records: {},
uiFlags: {
isFetching: false,
isUpdating: false,
isError: false,
},
};
@@ -38,6 +40,30 @@ export const actions = {
});
}
},
update: async ({ commit }, { conversationId, labels }) => {
commit(types.default.SET_CONVERSATION_LABELS_UI_FLAG, {
isUpdating: true,
});
try {
const response = await ConversationAPI.updateLabels(
conversationId,
labels
);
commit(types.default.SET_CONVERSATION_LABELS, {
id: conversationId,
data: response.data.payload,
});
commit(types.default.SET_CONVERSATION_LABELS_UI_FLAG, {
isUpdating: false,
isError: false,
});
} catch (error) {
commit(types.default.SET_CONVERSATION_LABELS_UI_FLAG, {
isUpdating: false,
isError: true,
});
}
},
};
export const mutations = {