feat: Select article list in sight

This commit is contained in:
2025-05-31 06:35:05 +03:00
parent 5ef61bcef4
commit 2e6917406e
21 changed files with 899 additions and 498 deletions

View File

@@ -0,0 +1,36 @@
import { authInstance } from "@shared";
import { makeAutoObservable, runInAction } from "mobx";
export type Article = {
id: string;
heading: string;
body: string;
service_name: string;
};
class ArticlesStore {
constructor() {
makeAutoObservable(this);
}
articles: Article[] = [];
articleData: Article | null = null;
getArticles = async () => {
const response = await authInstance.get("/article");
runInAction(() => {
this.articles = response.data;
});
};
getArticle = async (id: string) => {
const response = await authInstance.get(`/article/${id}`);
runInAction(() => {
this.articleData = response.data;
});
};
}
export const articlesStore = new ArticlesStore();