Skip to content

Commit

Permalink
fix: 2 type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pure-js committed Jan 10, 2025
1 parent 39fe9f1 commit 6816696
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/client/app/routes/posts/[postId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useLiveQuery } from 'dexie-react-hooks';
import { db } from '~/services/db';
import type { IBlogPost } from '~/components/post-preview';

function Post({ heading, text }: IBlogPost) {
function Post({ heading, text }: Partial<IBlogPost>) {
const navigate = useNavigate();

const handleNavigate = () => {
Expand Down
9 changes: 8 additions & 1 deletion apps/client/app/services/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export interface IAuthor {
id: string;
username: string;
name: string;
dob: string;
createdAt: number;
}

export interface IPost {
Expand Down Expand Up @@ -42,6 +44,11 @@ export const db = new MySubClassedDexie();
db.posts.count((count) => {
if (count === 0) {
db.posts.bulkPut(postsJson.result);
db.authors.bulkPut(authorsJson);
db.authors.bulkPut(
authorsJson.map((author) => ({
...author,
createdAt: Date.parse(author.createdAt),
})),
);
}
});

0 comments on commit 6816696

Please sign in to comment.