6f1a71e8bd
Deploy / Build Production Runtime Images (push) Successful in 9m5s
Deploy / Deploy Production (push) Successful in 46s
Deploy / Production Browser E2E (push) Failing after 3m39s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
Deploy / Deploy Staging (push) Has been skipped
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import apiClient from './client';
|
|
|
|
export interface ProjectTitleItem {
|
|
id: string;
|
|
workspace_id: string;
|
|
project_id: string;
|
|
text: string;
|
|
category: 'default' | 'marketing' | 'tutorial' | 'story' | 'promo';
|
|
favorite: boolean;
|
|
usage_count: number;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export const getProjectTitles = async (projectId: string, activeOnly = false): Promise<ProjectTitleItem[]> => {
|
|
const response = await apiClient.get(`/projects/${projectId}/titles`, { params: { active_only: activeOnly } });
|
|
return response.data.items;
|
|
};
|
|
|
|
export const createProjectTitle = async (projectId: string, data: { workspace_id: string; text: string; category?: ProjectTitleItem['category']; favorite?: boolean }): Promise<ProjectTitleItem> => {
|
|
const response = await apiClient.post(`/projects/${projectId}/titles`, data);
|
|
return response.data;
|
|
};
|
|
|
|
export const updateProjectTitle = async (titleId: string, data: { text?: string; category?: ProjectTitleItem['category']; favorite?: boolean; is_active?: boolean }): Promise<ProjectTitleItem> => {
|
|
const response = await apiClient.patch(`/project-titles/${titleId}`, data);
|
|
return response.data;
|
|
};
|