mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: create separate folder for page service (#4764)
This commit is contained in:
parent
bdaef179b1
commit
b5bbdbfa8e
@ -6,9 +6,9 @@ import { EditorRefApi, generateJSONfromHTML } from "@plane/editor-core";
|
||||
// hooks
|
||||
import useReloadConfirmations from "@/hooks/use-reload-confirmation";
|
||||
// services
|
||||
import { PageService } from "@/services/page.service";
|
||||
import { ProjectPageService } from "@/services/page";
|
||||
import { IPageStore } from "@/store/pages/page.store";
|
||||
const pageService = new PageService();
|
||||
const projectPageService = new ProjectPageService();
|
||||
|
||||
type Props = {
|
||||
editorRef: React.RefObject<EditorRefApi>;
|
||||
@ -32,7 +32,7 @@ export const usePageDescription = (props: Props) => {
|
||||
const { data: descriptionYJS, mutate: mutateDescriptionYJS } = useSWR(
|
||||
workspaceSlug && projectId && pageId ? `PAGE_DESCRIPTION_${workspaceSlug}_${projectId}_${pageId}` : null,
|
||||
workspaceSlug && projectId && pageId
|
||||
? () => pageService.fetchDescriptionYJS(workspaceSlug.toString(), projectId.toString(), pageId.toString())
|
||||
? () => projectPageService.fetchDescriptionYJS(workspaceSlug.toString(), projectId.toString(), pageId.toString())
|
||||
: null,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
|
1
web/core/services/page/index.ts
Normal file
1
web/core/services/page/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./project-page.service";
|
@ -5,7 +5,7 @@ import { API_BASE_URL } from "@/helpers/common.helper";
|
||||
// services
|
||||
import { APIService } from "@/services/api.service";
|
||||
|
||||
export class PageService extends APIService {
|
||||
export class ProjectPageService extends APIService {
|
||||
constructor() {
|
||||
super(API_BASE_URL);
|
||||
}
|
@ -6,7 +6,7 @@ import { TLogoProps, TPage } from "@plane/types";
|
||||
import { EPageAccess } from "@/constants/page";
|
||||
import { EUserProjectRoles } from "@/constants/project";
|
||||
// services
|
||||
import { PageService } from "@/services/page.service";
|
||||
import { ProjectPageService } from "@/services/page";
|
||||
import { RootStore } from "../root.store";
|
||||
|
||||
export type TLoader = "submitting" | "submitted" | "saved";
|
||||
@ -69,7 +69,7 @@ export class PageStore implements IPageStore {
|
||||
// reactions
|
||||
disposers: Array<() => void> = [];
|
||||
// services
|
||||
pageService: PageService;
|
||||
pageService: ProjectPageService;
|
||||
|
||||
constructor(
|
||||
private store: RootStore,
|
||||
@ -144,7 +144,7 @@ export class PageStore implements IPageStore {
|
||||
removeFromFavorites: action,
|
||||
});
|
||||
|
||||
this.pageService = new PageService();
|
||||
this.pageService = new ProjectPageService();
|
||||
|
||||
const titleDisposer = reaction(
|
||||
() => this.name,
|
||||
|
@ -7,7 +7,7 @@ import { TPage, TPageFilters, TPageNavigationTabs } from "@plane/types";
|
||||
// helpers
|
||||
import { filterPagesByPageType, getPageName, orderPages, shouldFilterPage } from "@/helpers/page.helper";
|
||||
// services
|
||||
import { PageService } from "@/services/page.service";
|
||||
import { ProjectPageService } from "@/services/page";
|
||||
// store
|
||||
import { IPageStore, PageStore } from "@/store/pages/page.store";
|
||||
import { RootStore } from "../root.store";
|
||||
@ -48,7 +48,7 @@ export class ProjectPageStore implements IProjectPageStore {
|
||||
sortBy: "desc",
|
||||
};
|
||||
// service
|
||||
service: PageService;
|
||||
service: ProjectPageService;
|
||||
|
||||
constructor(private store: RootStore) {
|
||||
makeObservable(this, {
|
||||
@ -67,7 +67,7 @@ export class ProjectPageStore implements IProjectPageStore {
|
||||
removePage: action,
|
||||
});
|
||||
// service
|
||||
this.service = new PageService();
|
||||
this.service = new ProjectPageService();
|
||||
// initialize display filters of the current project
|
||||
reaction(
|
||||
() => this.store.router.projectId,
|
||||
|
Loading…
Reference in New Issue
Block a user