* [WEB-5134] refactor: update `web` ESLint configuration and refactor imports to use type imports - Enhanced ESLint configuration by adding new rules for import consistency and type imports. - Refactored multiple files to replace regular imports with type imports for better clarity and performance. - Ensured consistent use of type imports across the application to align with TypeScript best practices. * refactor: standardize type imports across components - Updated multiple files to replace regular imports with type imports for improved clarity and consistency. - Ensured adherence to TypeScript best practices in the rich filters and issue layouts components.
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
// helpers
|
|
import { STICKIES_PER_PAGE, API_BASE_URL } from "@plane/constants";
|
|
import type { TSticky } from "@plane/types";
|
|
// services
|
|
import { APIService } from "@/services/api.service";
|
|
|
|
export class StickyService extends APIService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
async createSticky(workspaceSlug: string, payload: Partial<TSticky>) {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/stickies/`, payload)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getStickies(
|
|
workspaceSlug: string,
|
|
cursor: string,
|
|
query?: string,
|
|
per_page?: number
|
|
): Promise<{ results: TSticky[]; total_pages: number }> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/stickies/`, {
|
|
params: {
|
|
cursor,
|
|
per_page: per_page || STICKIES_PER_PAGE,
|
|
query,
|
|
},
|
|
})
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getSticky(workspaceSlug: string, id: string) {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/stickies/${id}`)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async updateSticky(workspaceSlug: string, id: string, data: Partial<TSticky>) {
|
|
return await this.patch(`/api/workspaces/${workspaceSlug}/stickies/${id}/`, data)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async deleteSticky(workspaceSlug: string, id: string) {
|
|
return await this.delete(`/api/workspaces/${workspaceSlug}/stickies/${id}`)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
}
|