From 327035c153708a3deab09ce9848c5dbcb658e71c Mon Sep 17 00:00:00 2001 From: Alma Date: Sat, 12 Apr 2025 12:07:05 +0200 Subject: [PATCH] working leantime delete user 3 --- app/api/users/[userId]/route.ts | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/app/api/users/[userId]/route.ts b/app/api/users/[userId]/route.ts index 9bdd8937..25de7413 100644 --- a/app/api/users/[userId]/route.ts +++ b/app/api/users/[userId]/route.ts @@ -5,32 +5,7 @@ import { NextResponse } from "next/server"; // Helper function to get Leantime user ID by email async function getLeantimeUserId(email: string): Promise { try { - const response = await fetch('https://agilite.slm-lab.net/api/jsonrpc', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'X-API-Key': process.env.LEANTIME_TOKEN || '', - }, - body: JSON.stringify({ - method: 'leantime.rpc.Users.Users.usernameExist', - jsonrpc: '2.0', - id: 1, - params: { - username: email, - notUserId: 0 - } - }) - }); - - const data = await response.json(); - console.log('Leantime username check response:', data); - - if (!response.ok || !data.result) { - console.error('Failed to check Leantime user:', data); - return null; - } - - // If user exists, get their ID + // Get user directly by email const userResponse = await fetch('https://agilite.slm-lab.net/api/jsonrpc', { method: 'POST', headers: {