mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-10-04 22:46:53 +02:00
add chapters, no exposure
This commit is contained in:
1 parent
ab64d3283d
commit
fcbc5df149
6 files changed
+273
-32
No files matched your search
@@ -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