Migração completa para Logto - Remoção de Clerk finalizada

This commit is contained in:
2026-03-31 10:32:42 +00:00
parent 87a87ae228
commit 49538cfbd4
21 changed files with 371 additions and 688 deletions

View File

@@ -1,16 +1,16 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useAuth } from '@clerk/clerk-react';
import { useAuth } from '../context/useAuth';
import api from '../services/api';
import type { INotification } from '../types';
import { NotificationContext } from './NotificationContextState';
export const NotificationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const { orgId, isSignedIn } = useAuth();
const { isSignedIn } = useAuth();
const [notifications, setNotifications] = useState<INotification[]>([]);
const [loading, setLoading] = useState(false);
const fetchNotifications = useCallback(async () => {
if (!orgId || !isSignedIn) return;
if (!isSignedIn) return;
try {
if (notifications.length === 0) setLoading(true);
@@ -21,7 +21,7 @@ export const NotificationProvider: React.FC<{ children: React.ReactNode }> = ({
} finally {
setLoading(false);
}
}, [orgId, isSignedIn, notifications.length]);
}, [isSignedIn, notifications.length]);
const markAsRead = async (id: string) => {
try {
@@ -70,7 +70,7 @@ export const NotificationProvider: React.FC<{ children: React.ReactNode }> = ({
// Polling effect
useEffect(() => {
if (isSignedIn && orgId) {
if (isSignedIn) {
fetchNotifications(); // Initial fetch
const interval = setInterval(() => {
@@ -81,7 +81,7 @@ export const NotificationProvider: React.FC<{ children: React.ReactNode }> = ({
} else {
setNotifications([]);
}
}, [isSignedIn, orgId, fetchNotifications]);
}, [isSignedIn, fetchNotifications]);
const unreadCount = notifications.filter(n => !n.isRead).length;