This update includes creating new files for the notifications feature along with adding two feature flags for enabling notifications and realtime notifications. All the code and package dependencies required for the notifications functionality have been added. The 'pnpm-lock.yaml' has also been updated due to the inclusion of new package dependencies.
22 lines
454 B
TypeScript
22 lines
454 B
TypeScript
import { useCallback } from 'react';
|
|
|
|
import { useSupabase } from '@kit/supabase/hooks/use-supabase';
|
|
|
|
export function useDismissNotification() {
|
|
const client = useSupabase();
|
|
|
|
return useCallback(
|
|
async (notification: number) => {
|
|
const { error } = await client
|
|
.from('notifications')
|
|
.update({ dismissed: true })
|
|
.eq('id', notification);
|
|
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
},
|
|
[client],
|
|
);
|
|
}
|