Added UI and functionality for profiles

This commit is contained in:
2026-02-12 14:17:24 -08:00
parent f879d25bc7
commit 8fc8d737e5
7 changed files with 282 additions and 139 deletions

View File

@@ -6,9 +6,16 @@ header('Content-Type: application/json');
require_login();
$user_id = current_user_id();
$profile_id = $_SESSION['active_profile_id'] ?? null;
$stmt = $pdo->prepare("SELECT * FROM projects WHERE user_id = ? ORDER BY sort_order ASC");
$stmt->execute([$user_id]);
if (!$profile_id) {
http_response_code(400);
echo json_encode(['success' => false, 'error' => 'No active profile']);
exit;
}
$stmt = $pdo->prepare("SELECT * FROM projects WHERE user_id = ? AND profile_id = ? ORDER BY sort_order ASC");
$stmt->execute([$user_id, $profile_id]);
$projects = $stmt->fetchAll();
foreach ($projects as &$project) {
@@ -23,4 +30,4 @@ foreach ($projects as &$project) {
}
}
echo json_encode($projects);
echo json_encode($projects);