add simple admin service
Build and deploy / deploy (push) Successful in 16s

This commit is contained in:
2026-05-18 02:48:47 +03:00
parent 10a83d39a2
commit 3a3b2bcfc0
84 changed files with 2134 additions and 5 deletions
@@ -0,0 +1,31 @@
import { fetchJson } from '../../shared/api/http.js';
export async function getArticles() {
const response = await fetchJson('/api/articles');
return response.articles;
}
export async function createArticle(article) {
const response = await fetchJson('/api/articles', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ article }),
});
return response.article;
}
export async function updateArticle(slug, article) {
const response = await fetchJson(`/api/articles/${encodeURIComponent(slug)}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ article }),
});
return response.article;
}
export async function deleteArticle(slug) {
const response = await fetchJson(`/api/articles/${encodeURIComponent(slug)}`, { method: 'DELETE' });
return response.article;
}