RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/views/banners/hooks/useDismissUserBannerMutation.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useMethod, useToastMessageDispatch } from '@rocket.chat/ui-contexts';
import { useMutation } from '@tanstack/react-query';

export const useDismissUserBannerMutation = () => {
    const dismissBanner = useMethod('banner/dismiss');

    const dispatchToastMessage = useToastMessageDispatch();

    return useMutation(dismissBanner, {
        onError: (error) => {
            dispatchToastMessage({ type: 'error', message: error });
        },
    });
};