refactor: convert more files to typescript
This commit is contained in:
19 files changed
+93
-451
No files matched your search
@@ -16,11 +16,11 @@ export default function LikeButton({
|
||||
userId,
|
||||
itemName,
|
||||
}: {
|
||||
itemId: string;
|
||||
isFavorite: boolean;
|
||||
queryKey: string[];
|
||||
userId: string;
|
||||
itemName: string;
|
||||
itemId: string | undefined;
|
||||
isFavorite: boolean | undefined;
|
||||
queryKey: string[] | undefined;
|
||||
userId: string | undefined;
|
||||
itemName: string | undefined;
|
||||
}) {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const queryClient = useQueryClient();
|
||||
@@ -29,6 +29,9 @@ export default function LikeButton({
|
||||
const handleLiking = async () => {
|
||||
let result: UserItemDataDto = null!;
|
||||
if (!api) return;
|
||||
if (!userId) return;
|
||||
if (!itemId) return;
|
||||
if (!itemName) return;
|
||||
if (isFavorite) {
|
||||
result = (
|
||||
await getUserLibraryApi(api).unmarkFavoriteItem({
|
||||
|
||||
@@ -16,11 +16,11 @@ export default function MarkPlayedButton({
|
||||
userId,
|
||||
itemName,
|
||||
}: {
|
||||
itemId: string;
|
||||
isPlayed: boolean;
|
||||
queryKey: string[];
|
||||
userId: string;
|
||||
itemName: string;
|
||||
itemId?: string;
|
||||
isPlayed?: boolean;
|
||||
queryKey?: string[];
|
||||
userId?: string;
|
||||
itemName?: string;
|
||||
}) {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
@@ -30,6 +30,11 @@ export default function MarkPlayedButton({
|
||||
const handleMarking = async () => {
|
||||
let result = null;
|
||||
if (!api) return;
|
||||
if (!api) return;
|
||||
if (!userId) return;
|
||||
if (!itemId) return;
|
||||
if (!itemName) return;
|
||||
|
||||
if (!isPlayed) {
|
||||
result = await getPlaystateApi(api).markPlayedItem({
|
||||
userId: userId,
|
||||
|
||||
@@ -53,7 +53,7 @@ type PlayButtonProps = {
|
||||
iconOnly?: boolean;
|
||||
audio?: boolean;
|
||||
size?: "small" | "large" | "medium";
|
||||
playlistItem?: BaseItemDto;
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
trackIndex?: number;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user