mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-26 10:31:10 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
17 lines
451 B
TypeScript
17 lines
451 B
TypeScript
import {toast} from 'react-hot-toast'
|
|
import {api} from 'web/lib/api'
|
|
|
|
export const handleReaction = async (reaction: string, id: number, toDelete?: boolean) => {
|
|
// console.log('handleReaction', {reaction, id, toDelete})
|
|
try {
|
|
await api('react-to-message', {
|
|
messageId: id,
|
|
reaction,
|
|
toDelete,
|
|
})
|
|
} catch (error) {
|
|
console.error('Error reacting to message:', error)
|
|
toast.error('Failed to add reaction')
|
|
}
|
|
}
|