Custom steps during tree navigation now support a complete workflow: - PostStepActionModal: Save for Later / Use Now / Both options - ContinuationModal: Pick descendant nodes or build custom branch - ForkTreeModal: Save modified tree as personal copy at completion - Custom steps are recorded in decisions array for export - Fix popular-tags API endpoint URL mismatch - Add aria-labels for accessibility on select/button elements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
import apiClient from './client'
|
|
import type {
|
|
Step,
|
|
StepListItem,
|
|
StepCreate,
|
|
StepUpdate,
|
|
StepListParams,
|
|
PopularTag,
|
|
RatingCreate,
|
|
RatingUpdate,
|
|
Rating,
|
|
Review
|
|
} from '@/types/step'
|
|
|
|
export const stepsApi = {
|
|
async list(params?: StepListParams): Promise<StepListItem[]> {
|
|
const response = await apiClient.get<StepListItem[]>('/steps', { params })
|
|
return response.data
|
|
},
|
|
|
|
async get(id: string): Promise<Step> {
|
|
const response = await apiClient.get<Step>(`/steps/${id}`)
|
|
return response.data
|
|
},
|
|
|
|
async create(data: StepCreate): Promise<Step> {
|
|
const response = await apiClient.post<Step>('/steps', data)
|
|
return response.data
|
|
},
|
|
|
|
async update(id: string, data: StepUpdate): Promise<Step> {
|
|
const response = await apiClient.put<Step>(`/steps/${id}`, data)
|
|
return response.data
|
|
},
|
|
|
|
async delete(id: string): Promise<void> {
|
|
await apiClient.delete(`/steps/${id}`)
|
|
},
|
|
|
|
async search(query: string): Promise<StepListItem[]> {
|
|
const response = await apiClient.get<StepListItem[]>('/steps/search', {
|
|
params: { q: query }
|
|
})
|
|
return response.data
|
|
},
|
|
|
|
async getPopularTags(): Promise<PopularTag[]> {
|
|
const response = await apiClient.get<PopularTag[]>('/steps/tags/popular')
|
|
return response.data
|
|
},
|
|
|
|
async rate(id: string, data: RatingCreate): Promise<Rating> {
|
|
const response = await apiClient.post<Rating>(`/steps/${id}/ratings`, data)
|
|
return response.data
|
|
},
|
|
|
|
async updateRating(id: string, data: RatingUpdate): Promise<Rating> {
|
|
const response = await apiClient.put<Rating>(`/steps/${id}/ratings`, data)
|
|
return response.data
|
|
},
|
|
|
|
async deleteRating(id: string): Promise<void> {
|
|
await apiClient.delete(`/steps/${id}/ratings`)
|
|
},
|
|
|
|
async getReviews(id: string): Promise<Review[]> {
|
|
const response = await apiClient.get<Review[]>(`/steps/${id}/reviews`)
|
|
return response.data
|
|
}
|
|
}
|
|
|
|
export default stepsApi
|