Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet committed Dec 13, 2024
1 parent 128d3f1 commit fe30233
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/lib/albert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,19 @@ type AlbertCollection = {

export const useAlbertCollections = () => {
const [collections, setCollections] = useState<AlbertCollection[]>([]);
const loadCollections = async () => {

const reloadCollections = async () => {
const collections = await albertApi({
path: "/collections",
method: "GET",
});
return collections;
setCollections(collections.data || []);
};

useEffect(() => {
reloadCollections();
}, []);
}, [reloadCollections]);

const reloadCollections = () => {
loadCollections().then((res) => {
setCollections(res.data);
});
};
return { collections, reloadCollections };
};

Expand Down

0 comments on commit fe30233

Please sign in to comment.