mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
20 lines
368 B
TypeScript
20 lines
368 B
TypeScript
import { tuyau } from '~/lib/tuyau';
|
|
import { Link } from '~/types/app';
|
|
|
|
export const onFavorite = (
|
|
linkId: Link['id'],
|
|
isFavorite: boolean,
|
|
cb: () => void
|
|
) => {
|
|
tuyau
|
|
.$route('link.toggle-favorite', {
|
|
id: linkId.toString(),
|
|
})
|
|
.$put({
|
|
favorite: isFavorite,
|
|
params: { id: linkId.toString() },
|
|
})
|
|
.then(() => cb())
|
|
.catch(console.error);
|
|
};
|