clawchain/dex-app/modules/common/hooks/useTogglePoolToFavorite.ts
2026-05-15 19:18:10 +03:00

14 lines
332 B
TypeScript

export const useTogglePoolToFavorite = (
pool: string,
...favoritesPools: any
) => {
const newFavoritePools = [...favoritesPools];
const poolIndex = favoritesPools.indexOf(pool);
if (poolIndex > -1) {
newFavoritePools.splice(poolIndex, 1);
} else {
newFavoritePools.push(pool);
}
return newFavoritePools;
};