quick implementation of crete_bookmark on weights page

This commit is contained in:
Victor committed 2023-12-22 14:10:22 -05:00
1 parent 5c2782e638
commit ae7879a320
3 files changed
+39 -4

No files matched your search

@@ -0,0 +1,16 @@
import MakeRequest from "../MakeRequest";
export interface CreateBookmarkRequest {
entity_token: string,
entity_type: string
}
export interface CreateBookmarkResponse {
success: boolean,
user_bookmark_token: string
}
export const CreateBookmark = MakeRequest<string, CreateBookmarkRequest, CreateBookmarkResponse,{}>({
method: "POST",
routingFunction: () => `/v1/user_bookmarks/create`,
});
@@ -0,0 +1,14 @@
import { useEffect } from 'react';
interface Props {
value?: any;
}
export default function useBookmarks({ value }: Props) {
// const [value, ] = useState(false);
// useEffect(() => {
// console.log(value);
// },[value]);
return;
};
@@ -35,6 +35,7 @@ import Modal from "components/common/Modal";
import SocialButton from "components/common/SocialButton";
import Input from "components/common/Input";
import { GetWeight } from "@storyteller/components/src/api/weights/GetWeight";
import { CreateBookmark } from "@storyteller/components/src/api/bookmarks/CreateBookmark";
interface WeightProps {
sessionWrapper: SessionWrapper;
@@ -310,10 +311,14 @@ export default function WeightPage({
);
}
const handleBookmark = async (data: any) => {
console.log(
`The item is now ${data.isLiked ? "Bookmarked" : "Not Bookmarked"}.`
);
const handleBookmark = (toggled: boolean) => {
return CreateBookmark("",{
entity_token: weight_token,
entity_type: "model_weight"
})
.then((res: any) => {
console.log("🔖",res);
});
};
const subtitleDivider = <span className="opacity-25 fs-5 fw-light">|</span>;