mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
added useRatings WIP hook
This commit is contained in:
1 parent
547a945bdf
commit
dc55cf9e50
4 files changed
+30
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import MakeRequest from "../MakeRequest";
|
||||
|
||||
export interface SetRatingRequest {
|
||||
entity_token: string,
|
||||
entity_type: string,
|
||||
rating_value: string
|
||||
}
|
||||
|
||||
export interface SetRatingResponse {
|
||||
success: boolean
|
||||
}
|
||||
|
||||
export const SetRating = MakeRequest<string, SetRatingRequest, SetRatingResponse,{}>({
|
||||
method: "POST",
|
||||
routingFunction: () => `/v1/user_rating/rate`,
|
||||
});
|
||||
@@ -9,6 +9,7 @@ import useLazyLists from './useLazyLists';
|
||||
import useListContent from './useListContent';
|
||||
import useLocalize from './useLocalize';
|
||||
import useMedia from './useMedia';
|
||||
import useRatings from './useRatings';
|
||||
import useSession from './useSession';
|
||||
import useVideo from './useVideo';
|
||||
import useWeightFetch from './useWeightFetch';
|
||||
@@ -25,6 +26,7 @@ export {
|
||||
useListContent,
|
||||
useLocalize,
|
||||
useMedia,
|
||||
useRatings,
|
||||
useSession,
|
||||
useVideo,
|
||||
useWeightFetch
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./useRatings";
|
||||
@@ -0,0 +1,11 @@
|
||||
import { useState } from 'react';
|
||||
import { FetchStatus } from "@storyteller/components/src/api/_common/SharedFetchTypes";
|
||||
|
||||
interface Props {
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export default function useRatings({ value }: Props) {
|
||||
const [status, statusSet] = useState(FetchStatus.ready);
|
||||
return { status, statusSet };
|
||||
};
|
||||
Reference in new issue
Block a user