fix(frontend): resolve published blog detail 404
This commit is contained in:
@@ -422,7 +422,7 @@ class ApiClient {
|
||||
}
|
||||
|
||||
async getPost(slug: string) {
|
||||
return this.request<Types.PostDetailSchema>(`/api/blog/posts/${slug}`);
|
||||
return this.request<Types.PostDetailSchema>(`/api/blog/posts/${encodeURIComponent(slug)}`);
|
||||
}
|
||||
|
||||
async createPost(data: Types.PostCreateSchema) {
|
||||
@@ -511,7 +511,7 @@ class ApiClient {
|
||||
}
|
||||
|
||||
async deletePost(slug: string) {
|
||||
return this.request<Types.MessageSchema>(`/api/blog/posts/${slug}`, {
|
||||
return this.request<Types.MessageSchema>(`/api/blog/posts/${encodeURIComponent(slug)}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
@@ -528,11 +528,11 @@ class ApiClient {
|
||||
|
||||
// Comments
|
||||
async getComments(slug: string) {
|
||||
return this.request<Types.CommentSchema[]>(`/api/blog/posts/${slug}/comments`);
|
||||
return this.request<Types.CommentSchema[]>(`/api/blog/posts/${encodeURIComponent(slug)}/comments`);
|
||||
}
|
||||
|
||||
async createComment(slug: string, data: Types.CommentCreateSchema) {
|
||||
return this.request<Types.CommentSchema>(`/api/blog/posts/${slug}/comments`, {
|
||||
return this.request<Types.CommentSchema>(`/api/blog/posts/${encodeURIComponent(slug)}/comments`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
@@ -557,23 +557,23 @@ class ApiClient {
|
||||
|
||||
// Likes
|
||||
async toggleLike(slug: string) {
|
||||
return this.request<Types.BlogInteractionSchema>(`/api/blog/posts/${slug}/like`, {
|
||||
return this.request<Types.BlogInteractionSchema>(`/api/blog/posts/${encodeURIComponent(slug)}/like`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
async toggleSave(slug: string) {
|
||||
return this.request<Types.BlogInteractionSchema>(`/api/blog/posts/${slug}/save`, {
|
||||
return this.request<Types.BlogInteractionSchema>(`/api/blog/posts/${encodeURIComponent(slug)}/save`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
async getBlogInteraction(slug: string) {
|
||||
return this.request<Types.BlogInteractionSchema>(`/api/blog/posts/${slug}/interaction`);
|
||||
return this.request<Types.BlogInteractionSchema>(`/api/blog/posts/${encodeURIComponent(slug)}/interaction`);
|
||||
}
|
||||
|
||||
async getLikesCount(slug: string) {
|
||||
return this.request<Types.MessageSchema>(`/api/blog/posts/${slug}/likes`);
|
||||
return this.request<Types.MessageSchema>(`/api/blog/posts/${encodeURIComponent(slug)}/likes`);
|
||||
}
|
||||
|
||||
async getMyBlogActivity() {
|
||||
|
||||
Reference in New Issue
Block a user