[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:
parent
39ca600091
commit
ade4d290f5
66 changed files with 1002 additions and 631 deletions
|
|
@ -1,3 +1,4 @@
|
|||
export * from "./link.service";
|
||||
export * from "./module.service";
|
||||
export * from "./operations.service";
|
||||
export * from "./sites-module.service";
|
||||
|
|
|
|||
31
packages/services/src/module/sites-module.service.ts
Normal file
31
packages/services/src/module/sites-module.service.ts
Normal 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;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue