2024-06-04 08:08:47 +00:00
|
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
|
|
|
// services
|
|
|
|
import { APIService } from "@/services/api.service";
|
|
|
|
// types
|
|
|
|
import { TPublishSettings } from "@/types/publish";
|
|
|
|
|
|
|
|
class PublishService extends APIService {
|
|
|
|
constructor() {
|
|
|
|
super(API_BASE_URL);
|
|
|
|
}
|
|
|
|
|
|
|
|
async fetchPublishSettings(anchor: string): Promise<TPublishSettings> {
|
|
|
|
return this.get(`/api/public/publish-settings/${anchor}/`)
|
|
|
|
.then((response) => response?.data)
|
|
|
|
.catch((error) => {
|
|
|
|
throw error?.response;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-06-04 13:49:27 +00:00
|
|
|
async fetchAnchorFromProjectDetails(
|
2024-06-04 08:08:47 +00:00
|
|
|
workspaceSlug: string,
|
|
|
|
projectID: string
|
|
|
|
): Promise<{
|
|
|
|
anchor: string;
|
|
|
|
}> {
|
2024-06-04 13:49:27 +00:00
|
|
|
return this.get(`/api/public/workspaces/${workspaceSlug}/projects/${projectID}/anchor/`)
|
2024-06-04 08:08:47 +00:00
|
|
|
.then((response) => response?.data)
|
|
|
|
.catch((error) => {
|
|
|
|
throw error?.response;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PublishService;
|