Implementasi Backend pada login, FAQ, Settings Intern, Projects Intern, Home Intern

This commit is contained in:
Kemas M. Aryadary Rasyad
2026-06-25 00:35:53 +07:00
parent 9e5a97ef10
commit f63efb0e12
29 changed files with 682 additions and 280 deletions
+40
View File
@@ -0,0 +1,40 @@
import { useEffect, useState } from "react";
// Projects
import { getMyProjects } from "../services/ProjectService";
import type { Project } from "../types/project.types";
// Tasks
import { getMyTasks } from "../services/ProjectService";
import type { InternTask } from "../types/project.types";
export const useProjects = () => {
const [projects, setProjects] = useState<Project[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
setLoading(true);
getMyProjects()
.then(setProjects)
.catch(() => setError("Gagal memuat project."))
.finally(() => setLoading(false));
}, []);
return { projects, loading, error };
};
export const useInternTasks = () => {
const [tasks, setTasks] = useState<InternTask[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
setLoading(true);
getMyTasks()
.then(setTasks)
.catch(() => setError("Gagal memuat tasks."))
.finally(() => setLoading(false));
}, []);
return { tasks, loading, error };
};