fix(admin): nav issues and blank screens fix
This commit is contained in:
@ -2,7 +2,30 @@
|
||||
* Reports are now generated directly from Supabase queries in the AdminReports view. */
|
||||
import { supabase } from '@/supabase';
|
||||
|
||||
export interface Report {
|
||||
id: string;
|
||||
user_id: string;
|
||||
user_name?: string;
|
||||
message: string;
|
||||
status: 'pending' | 'resolved' | 'archived';
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export const reportsService = {
|
||||
async getReports(): Promise<Report[]> {
|
||||
const { data, error } = await supabase.from('reports').select('*').order('created_at', { ascending: false })
|
||||
if (error) {
|
||||
console.warn('Reports table might not exist or error fetching', error)
|
||||
return []
|
||||
}
|
||||
return data as Report[]
|
||||
},
|
||||
|
||||
async updateReportStatus(id: string, status: string): Promise<void> {
|
||||
const { error } = await supabase.from('reports').update({ status }).eq('id', id)
|
||||
if (error) throw new Error(error.message)
|
||||
},
|
||||
|
||||
async getRoutesReport() {
|
||||
const { data, error } = await supabase.from('routes').select('*')
|
||||
if (error) throw new Error(error.message)
|
||||
|
||||
Reference in New Issue
Block a user