fix: Language cache sight
This commit is contained in:
27
src/shared/store/MediaStore/index.tsx
Normal file
27
src/shared/store/MediaStore/index.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
import { authInstance } from "@shared";
|
||||
|
||||
type Media = {
|
||||
id: string;
|
||||
filename: string;
|
||||
media_name: string;
|
||||
media_type: number;
|
||||
};
|
||||
|
||||
class MediaStore {
|
||||
media: Media[] = [];
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
getMedia = async () => {
|
||||
const response = await authInstance.get("/media");
|
||||
|
||||
runInAction(() => {
|
||||
this.media = [...response.data];
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export const mediaStore = new MediaStore();
|
||||
Reference in New Issue
Block a user