import { OWNER_ID } from "@/lib/auth" import { ApiError } from "@/lib/types" import { root } from '@repo/core' import { ActivityController, ListActivitiesResult } from "@repo/sdk" import { useState } from "react" export const useActivates = () => { const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const [data, setData] = useState() const load = async () => { try { setLoading(true) const c = root.get(ActivityController) const data = await c.list({ page: 1, limit: 10, isActive: true, orderBy: 'sortOrder', order: 'desc', ownerId: OWNER_ID }) setData(data) } catch (e) { setError(e as ApiError) } finally { setLoading(false) } } return { load, loading, error, data } }