Skip to content

Commit

Permalink
Blog型をBlogInputData型に変更する
Browse files Browse the repository at this point in the history
  • Loading branch information
nagutabby committed Feb 22, 2025
1 parent ea72319 commit 59dbb68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { MicroCMSQueries } from "microcms-js-sdk";
import { getList } from "$lib/microcms";
import type { PageLoad } from "./$types";
import type { BlogInputData } from "../types/blog";
import { getList } from "$lib/microcms";

export const load: PageLoad = async ({ url }) => {
const page = Number(url.searchParams.get("page")) || 1;
Expand All @@ -13,7 +14,7 @@ export const load: PageLoad = async ({ url }) => {
};
const articleData = await getList(pageQueries);

const blogData: Blog = {
const blogData: BlogInputData = {
image: {
url: "https://images.microcms-assets.io/assets/99c53a99ae2b4682938f6c435d83e3d9/ca63de19468e45b2833ebf325dbfd56c/Microsoft-Fluentui-Emoji-3d-Cat-3d.1024.png"
},
Expand Down
3 changes: 2 additions & 1 deletion src/routes/search/+page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { MicroCMSQueries } from "microcms-js-sdk";
import type { PageLoad } from "./$types";
import type { BlogInputData } from "../../types/blog";
import { getList } from "$lib/microcms";

export const load: PageLoad = async ({ url }) => {
Expand All @@ -18,7 +19,7 @@ export const load: PageLoad = async ({ url }) => {
};

const articleData = await getList(pageQueries);
const blogData: Blog = {
const blogData: BlogInputData = {
image: {
url: "https://images.microcms-assets.io/assets/99c53a99ae2b4682938f6c435d83e3d9/ca63de19468e45b2833ebf325dbfd56c/Microsoft-Fluentui-Emoji-3d-Cat-3d.1024.png"
},
Expand Down
12 changes: 4 additions & 8 deletions src/types/blog.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
type Blog = {
image?: {
url: string;
}
title?: string;
titles?: string[];
description?: string;
}
import type { Blog } from "$lib/microcms";

export type BlogInputData = Pick<Blog, "title" | "image" | "body">

0 comments on commit 59dbb68

Please sign in to comment.