diff --git a/Frontend/lib/auth-context.tsx b/Frontend/lib/auth-context.tsx
index 3a9275d..a58897e 100644
--- a/Frontend/lib/auth-context.tsx
+++ b/Frontend/lib/auth-context.tsx
@@ -177,46 +177,49 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}
} catch (e) {
console.error(e)
- const deleteTicket = useCallback(async (ticketId: number) => {
- if (!authHeader) return
- try {
- const res = await fetch(`${API_URL}/tickets/${ticketId}`, {
- method: "DELETE",
- headers: { "Authorization": authHeader }
- })
- if (res.ok) {
- fetchTickets(authHeader)
- }
- } catch (e) {
- console.error(e)
- }
- }, [authHeader, fetchTickets])
-
- return (
-
- {children}
-
- )
}
+ }, [authHeader, fetchTickets])
- export function useAuth() {
- const context = useContext(AuthContext)
- if (!context) {
- throw new Error("useAuth must be used within an AuthProvider")
+ const deleteTicket = useCallback(async (ticketId: number) => {
+ if (!authHeader) return
+ try {
+ const res = await fetch(`${API_URL}/tickets/${ticketId}`, {
+ method: "DELETE",
+ headers: { "Authorization": authHeader }
+ })
+ if (res.ok) {
+ fetchTickets(authHeader)
}
- return context
+ } catch (e) {
+ console.error(e)
}
+ }, [authHeader, fetchTickets])
+
+ return (
+
+ {children}
+
+ )
+}
+
+export function useAuth() {
+ const context = useContext(AuthContext)
+ if (!context) {
+ throw new Error("useAuth must be used within an AuthProvider")
+ }
+ return context
+}