Skip to content

Commit 3ff1e40

Browse files
committed
Błędy lintingu ix
- Usuń nieużywane zmienne (token, parseError, profileError, data, _id) - Dodaj obsługę błędów dla profileError w funkcji delete-task - Naprawiono zależności useMemo w UsersTable i TaskTable - Dodano komentarz eslint-disable dla haka useNavigation - Rozwiązano wszystkie błędy lintingu
1 parent aa5576c commit 3ff1e40

8 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/components/tasks/TaskTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export default function TaskTable() {
198198
},
199199
},
200200
],
201-
[deletingTaskId, user]
201+
[deletingTaskId, user, handleDelete]
202202
);
203203

204204
const table = useReactTable({

src/components/users/UsersTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default function UsersTable() {
119119
},
120120
},
121121
],
122-
[deletingUserId]
122+
[deletingUserId, handleDelete]
123123
);
124124

125125
const table = useReactTable({

src/context/NavigationContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function NavigationProvider({ children }: { children: ReactNode }) {
1919
);
2020
}
2121

22+
// eslint-disable-next-line react-refresh/only-export-components
2223
export function useNavigation() {
2324
const context = useContext(NavigationContext);
2425
if (context === undefined) {

src/store/authStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const useAuthStore = create<AuthStore>((set) => ({
102102
signUp: async (email: string, password: string, fullName: string) => {
103103
try {
104104
// Używamy zwykłego signUp, ale email będzie wymagał potwierdzenia przez admina
105-
const { data, error } = await supabase.auth.signUp({
105+
const { error } = await supabase.auth.signUp({
106106
email,
107107
password,
108108
options: {

src/store/usersStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const useUsersStore = create<UsersStore>((set, get) => ({
133133
}
134134
},
135135

136-
confirmUserEmail: async (_id) => {
136+
confirmUserEmail: async () => {
137137
// Ta funkcja jest przestarzała, użyj updateUser z active: 1
138138
return { error: new Error('Use updateUser with active: 1 instead') };
139139
},

supabase/functions/add-task/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ Deno.serve(async (req: Request) => {
2222
return new Response(JSON.stringify({ error: 'Missing auth header' }), { status: 401, headers: corsHeaders });
2323
}
2424

25-
const token = authHeader.replace('Bearer ', '');
26-
2725
// Get request body first
2826
let body;
2927
try {
3028
body = await req.json();
31-
} catch (parseError) {
29+
} catch {
3230
return new Response(
3331
JSON.stringify({ error: 'Invalid request body' }),
3432
{

supabase/functions/add-user/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ Deno.serve(async (req: Request) => {
2525
return new Response(JSON.stringify({ error: 'Missing auth header' }), { status: 401, headers: corsHeaders })
2626
}
2727

28-
const token = authHeader.replace('Bearer ', '')
29-
3028
// Get request body first (before auth check to avoid parsing issues)
3129
let body
3230
try {
3331
body = await req.json()
34-
} catch (parseError) {
32+
} catch {
3533
return new Response(
3634
JSON.stringify({ error: 'Invalid request body' }),
3735
{

supabase/functions/delete-task/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,17 @@ Deno.serve(async (req: Request) => {
8686
.eq('id', user.id)
8787
.single();
8888

89-
const isAdmin = userProfile?.role === 'admin';
89+
if (profileError || !userProfile) {
90+
return new Response(
91+
JSON.stringify({ error: 'Error checking user permissions', details: profileError?.message }),
92+
{
93+
status: 500,
94+
headers: { ...corsHeaders, 'Content-Type': 'application/json' }
95+
}
96+
);
97+
}
98+
99+
const isAdmin = userProfile.role === 'admin';
90100
const isOwner = task.user_id === user.id;
91101

92102
if (!isAdmin && !isOwner) {

0 commit comments

Comments
 (0)