[WEB-3066] refactor: replace Space Services with Services Package (#6353)

* [WEB-3066] refactor: replace Space Services with Services Package

* chore: minor improvements

* fix: type

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Prateek Shourya 2025-01-11 15:16:11 +05:30 committed by GitHub
parent 39ca600091
commit ade4d290f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 1002 additions and 631 deletions

View file

@ -1,3 +1,4 @@
export * from "./link.service";
export * from "./module.service";
export * from "./operations.service";
export * from "./sites-module.service";

View file

@ -0,0 +1,31 @@
// plane imports
import { API_BASE_URL } from "@plane/constants";
// api service
import { TPublicModule } from "@plane/types";
import { APIService } from "../api.service";
/**
* Service class for managing modules within plane sites application.
* Extends APIService to handle HTTP requests to the module-related endpoints.
* @extends {APIService}
* @remarks This service is only available for plane sites
*/
export class SitesModuleService extends APIService {
constructor(BASE_URL?: string) {
super(BASE_URL || API_BASE_URL);
}
/**
* Retrieves a list of modules for a specific anchor.
* @param {string} anchor - The anchor identifier
* @returns {Promise<TPublicModule[]>} The list of modules
* @throws {Error} If the API request fails
*/
async list(anchor: string): Promise<TPublicModule[]> {
return this.get(`/api/public/anchor/${anchor}/modules/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}