feat: implement categorized global search with RBAC
- Added /api/search endpoint with strict role-based data isolation. - Created searchGlobal function in dataService. - Refined header UI with an interactive, categorized search results dropdown.
This commit is contained in:
@@ -17,6 +17,19 @@ const getHeaders = () => {
|
||||
};
|
||||
};
|
||||
|
||||
export const searchGlobal = async (query: string): Promise<{ members: User[], teams: any[], attendances: any[] }> => {
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/search?q=${encodeURIComponent(query)}`, {
|
||||
headers: getHeaders()
|
||||
});
|
||||
if (!response.ok) throw new Error('Search failed');
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error("API Error (searchGlobal):", error);
|
||||
return { members: [], teams: [], attendances: [] };
|
||||
}
|
||||
};
|
||||
|
||||
export const getAttendances = async (tenantId: string, filter: DashboardFilter): Promise<Attendance[]> => {
|
||||
try {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
Reference in New Issue
Block a user