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:
parent
c2ebde069d
commit
3f3c1516c8
7 changed files with 69 additions and 8 deletions
src/redux/messages
|
@ -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>) => ({
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue