mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 06:09:45 +00:00
Фикс лабораторий, убрал base
This commit is contained in:
1 parent
41d4487375
commit
43ca44dc71
3 files changed
+15
-3
No files matched your search
@@ -4,13 +4,25 @@ import { parseContent } from "@/shared/api/parseContent";
|
||||
import { App, WPv2 } from "@/shared/types/app";
|
||||
|
||||
export const fetchPostById = async (id: number): Promise<App.WpPostPage> => {
|
||||
const post = await wp.posts().id(id).get() as WPv2.Post;
|
||||
const [post, categories] = await Promise.all([
|
||||
wp.posts().id(id).get() as Promise<WPv2.Post>,
|
||||
wp.categories().get() as Promise<WPv2.Category[]>,
|
||||
]);
|
||||
|
||||
const categoryMap = new Map<number, string>(
|
||||
categories.map((c) => [c.id, c.name])
|
||||
);
|
||||
|
||||
const postCategories = post.categories.map(
|
||||
(id) => categoryMap.get(id) || ""
|
||||
);
|
||||
|
||||
const result: App.WpPostPage = {
|
||||
id: post.id,
|
||||
title: post.title.rendered,
|
||||
content: parseContent(post.content.rendered),
|
||||
tag: post.tags[0],
|
||||
categories: postCategories,
|
||||
};
|
||||
|
||||
return result;
|
||||
|
||||
@@ -58,6 +58,6 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
|
||||
result.other.push(newWpPostPage);
|
||||
}
|
||||
}
|
||||
console.log('fetchPosts result', result);
|
||||
|
||||
return result;
|
||||
};
|
||||
+1
-1
@@ -3,7 +3,7 @@ import react from "@vitejs/plugin-react";
|
||||
import path from "path";
|
||||
|
||||
export default defineConfig({
|
||||
base: '/wp-content/reactpress/apps/skb/dist/',
|
||||
// base: '/wp-content/reactpress/apps/skb/dist/',
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in new issue
Block a user