mirror of
https://github.com/expo/appjs25-eas-update-workshop-code.git
synced 2026-11-15 03:28:09 -10:00
20 lines
418 B
TypeScript
20 lines
418 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { LocalDatabase } from "@/data/api/local-database";
|
|
|
|
export const useFavsQuery = function () {
|
|
// Queries
|
|
const query = useQuery({
|
|
queryKey: [`favs`],
|
|
queryFn: async () => {
|
|
return await fetchFromLocal();
|
|
},
|
|
});
|
|
|
|
return query;
|
|
};
|
|
|
|
async function fetchFromLocal() {
|
|
const db = new LocalDatabase();
|
|
return await db.getFavorites();
|
|
}
|