mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-06-30 17:55:42 +02:00
add chapters, no exposure
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import axios from "axios";
|
||||
|
||||
export interface Chapter {
|
||||
id: string;
|
||||
name: string;
|
||||
city: string;
|
||||
state: string;
|
||||
website: string;
|
||||
}
|
||||
|
||||
export interface ChaptersResponse {
|
||||
data: Chapter[];
|
||||
meta?: {
|
||||
total_count: number;
|
||||
filter_count: number;
|
||||
};
|
||||
}
|
||||
|
||||
const CMS_BASE_URL = "https://cms.deflock.me";
|
||||
|
||||
const cmsApiService = axios.create({
|
||||
baseURL: CMS_BASE_URL,
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
export const cmsService = {
|
||||
async getChapters(): Promise<Chapter[]> {
|
||||
try {
|
||||
const response = await cmsApiService.get("/items/chapters?sort=name");
|
||||
return response.data.data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching chapters:", error);
|
||||
throw new Error("Failed to fetch chapters");
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user