feat: 调整api路径
This commit is contained in:
@@ -6,7 +6,7 @@ import { createHttp } from "@/lib/request";
|
|||||||
const http = createHttp(Astro.request.headers);
|
const http = createHttp(Astro.request.headers);
|
||||||
|
|
||||||
const { data: categories } =
|
const { data: categories } =
|
||||||
await http.get<ApiResponse<CategoriesStats[]>>("category/stats");
|
await http.get<ApiResponse<CategoriesStats[]>>("categories/stats");
|
||||||
---
|
---
|
||||||
|
|
||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {createHttp} from "@/lib/request";
|
|||||||
|
|
||||||
const http = createHttp(Astro.request.headers);
|
const http = createHttp(Astro.request.headers);
|
||||||
|
|
||||||
const {data} = await http.get<ApiResponse<Archive>>("post/archive");
|
const {data} = await http.get<ApiResponse<Archive>>("posts/archives");
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="归档">
|
<Layout title="归档">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { metadata } from "@/consts.ts";
|
|||||||
|
|
||||||
const http = createHttp(Astro.request.headers);
|
const http = createHttp(Astro.request.headers);
|
||||||
|
|
||||||
const { list, total } = await http.get<ApiPageResponse<Post>>("post", {
|
const { list, total } = await http.get<ApiPageResponse<Post>>("posts", {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: metadata.postPageSize,
|
page_size: metadata.postPageSize,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ if (isNaN(Number(page))) {
|
|||||||
|
|
||||||
const http = createHttp(Astro.request.headers);
|
const http = createHttp(Astro.request.headers);
|
||||||
|
|
||||||
const { list, total } = await http.get<ApiPageResponse<Post>>("post", {
|
const { list, total } = await http.get<ApiPageResponse<Post>>("posts", {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
page,
|
page,
|
||||||
page_size: metadata.postPageSize,
|
page_size: metadata.postPageSize,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ let data: Post;
|
|||||||
const http = createHttp(Astro.request.headers);
|
const http = createHttp(Astro.request.headers);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await http.get<ApiResponse<Post>>(`post/${slug}`);
|
const res = await http.get<ApiResponse<Post>>(`posts/${slug}`);
|
||||||
data = res.data;
|
data = res.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return Astro.redirect("/404");
|
return Astro.redirect("/404");
|
||||||
|
|||||||
Reference in New Issue
Block a user