mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 05:49:40 +02:00
* dev: workspace and project publish endpoints * dev: update folder structure to match the global structure * dev: add anchor to workspace and project pages * dev: formatting errors * dev: add public endpoint for pages * dev: publish workflow added * dev: update settings endpoint * dev: space app pages * chore: issue embeds in page publish * fix: page not updating * dev: added issue embed * chore: separate edition specific code * chore: update issue embed component * refactor: space app pages store * chore: issue embed error --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
101 lines
3.1 KiB
TypeScript
101 lines
3.1 KiB
TypeScript
// helpers
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
|
// plane web types
|
|
import { TPagePublishSettings } from "@/plane-web/types";
|
|
// services
|
|
import { APIService } from "@/services/api.service";
|
|
|
|
export class PublishPageService extends APIService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
// project level
|
|
async publishProjectPage(
|
|
workspaceSlug: string,
|
|
projectID: string,
|
|
pageID: string,
|
|
data: Partial<TPagePublishSettings>
|
|
): Promise<TPagePublishSettings> {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectID}/pages/${pageID}/publish/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async fetchProjectPagePublishSettings(
|
|
workspaceSlug: string,
|
|
projectID: string,
|
|
pageID: string
|
|
): Promise<TPagePublishSettings> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectID}/pages/${pageID}/publish/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async updateProjectPagePublishSettings(
|
|
workspaceSlug: string,
|
|
projectID: string,
|
|
pageID: string,
|
|
data: Partial<TPagePublishSettings>
|
|
): Promise<TPagePublishSettings> {
|
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectID}/pages/${pageID}/publish/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async unpublishProjectPage(workspaceSlug: string, projectID: string, pageID: string): Promise<void> {
|
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectID}/pages/${pageID}/publish/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
// workspace level
|
|
async publishWorkspacePage(
|
|
workspaceSlug: string,
|
|
pageID: string,
|
|
data: Partial<TPagePublishSettings>
|
|
): Promise<TPagePublishSettings> {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/pages/${pageID}/publish/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async fetchWorkspacePagePublishSettings(workspaceSlug: string, pageID: string): Promise<TPagePublishSettings> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/pages/${pageID}/publish/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async updateWorkspacePagePublishSettings(
|
|
workspaceSlug: string,
|
|
pageID: string,
|
|
data: Partial<TPagePublishSettings>
|
|
): Promise<TPagePublishSettings> {
|
|
return this.patch(`/api/workspaces/${workspaceSlug}/pages/${pageID}/publish/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async unpublishWorkspacePage(workspaceSlug: string, pageID: string): Promise<void> {
|
|
return this.delete(`/api/workspaces/${workspaceSlug}/pages/${pageID}/publish/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
}
|