1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-05 09:36:41 +07:00

fixed message delete appearance

This commit is contained in:
Fedor Katurov 2020-09-08 13:27:00 +07:00
parent c2ebde069d
commit 3f3c1516c8
7 changed files with 69 additions and 8 deletions
src/redux/messages

View file

@ -13,9 +13,10 @@ export const messagesSendMessage = (message: Partial<IMessage>, onSuccess) => ({
onSuccess,
});
export const messagesDeleteMessage = (id: IMessage['id']) => ({
export const messagesDeleteMessage = (id: IMessage['id'], is_locked: boolean) => ({
type: MESSAGES_ACTIONS.DELETE_MESSAGE,
id,
is_locked,
});
export const messagesSet = (messages: Partial<IMessagesState>) => ({

View file

@ -25,12 +25,17 @@ export const apiMessagesDeleteMessage = ({
access,
username,
id,
is_locked,
}: {
access: string;
username: string;
id: number;
is_locked: boolean;
}): Promise<IResultWithStatus<{ message: IMessage }>> =>
api
.delete(API.USER.MESSAGE_DELETE(username, id), configWithToken(access))
.delete(
API.USER.MESSAGE_DELETE(username, id),
configWithToken(access, { params: { is_locked } })
)
.then(resultMiddleware)
.catch(errorMiddleware);

View file

@ -120,7 +120,7 @@ function* sendMessage({ message, onSuccess }: ReturnType<typeof messagesSendMess
onSuccess();
}
function* deleteMessage({ id }: ReturnType<typeof messagesDeleteMessage>) {
function* deleteMessage({ id, is_locked }: ReturnType<typeof messagesDeleteMessage>) {
const username: ReturnType<typeof selectAuthProfileUsername> = yield select(
selectAuthProfileUsername
);
@ -135,6 +135,7 @@ function* deleteMessage({ id }: ReturnType<typeof messagesDeleteMessage>) {
{
username,
id,
is_locked,
}
);