Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/blocks/Author/Author.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Author = (props: AuthorProps) => {

const {post} = useContext(PostPageContext);

const author = post?.authors?.find(({id}: {id: number}) => id === authorId);
const author = post?.authors?.find(({id}: {id: number | string}) => id === authorId);

const authorItem = useMemo(() => {
const imageUrl = author?.avatar ?? image;
Expand Down
2 changes: 1 addition & 1 deletion src/components/PostInfo/components/Save.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const b = block('post-info');

type SaveProps = QAProps & {
title: string | number;
postId: number;
postId: number | string;
hasUserLike: boolean;
handleUserLike: () => void;
theme?: 'light' | 'dark';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useLikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {ToggleLikeCallbackType} from '../models/common';
type UseLikesProps = {
hasLike?: boolean;
count?: number;
postId?: number;
postId?: number | string;
toggleLikeCallback?: ToggleLikeCallbackType;
};

Expand Down
2 changes: 1 addition & 1 deletion src/models/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {PaddingsYFMProps} from './paddings';

// blocks props
export type AuthorProps = ClassNameProps & {
authorId: number;
authorId: number | string;
image: string;
} & PaddingsYFMProps &
QAProps;
Expand Down
10 changes: 5 additions & 5 deletions src/models/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ClassNameProps {
}

export type Author = {
id: number;
id: number | string;
avatar: string | null;
createdAt: string;
updatedAt: string;
Expand All @@ -31,7 +31,7 @@ export type Author = {
};

export type Service = {
id: number;
id: number | string;
slug: string;
name: string;
} & {
Expand Down Expand Up @@ -67,14 +67,14 @@ export type Tag = {
icon?: string;
isDeleted?: boolean;
locale?: string;
blogTagId?: number;
blogTagId?: number | string;
count?: number;
};

export interface PostData {
author?: string;
authors?: Author[];
blogPostId?: number;
blogPostId?: number | string;
content?: string;
date: string;
description?: string;
Expand Down Expand Up @@ -153,7 +153,7 @@ export type ToggleLikeCallbackType = ({
postId,
hasLike,
}: {
postId?: number;
postId?: number | string;
hasLike?: boolean;
}) => void;

Expand Down
4 changes: 2 additions & 2 deletions src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export const getTags = memoize((tags: Tag[], blogPath: string) => {
});
});

const stub = (postId: number) => postId;
const stub = (postId: number | string) => postId;

export const postLikeStatus = debounce((postId: number, hasUserLike: boolean) => {
export const postLikeStatus = debounce((postId: number | string, hasUserLike: boolean) => {
(hasUserLike ? stub : stub)(postId);
}, 300);

Expand Down