| 1234567891011121314151617181920212223242526272829303132 |
- import { SearchHistoryItem, SearchHistoryDetail } from '../types';
- import { apiClient } from './apiClient';
- export const searchHistoryService = {
- // 検索履歴リストの取得
- async getHistories(page: number = 1, limit: number = 20): Promise<{
- histories: SearchHistoryItem[];
- total: number;
- page: number;
- limit: number;
- }> {
- const { data } = await apiClient.get(`/search-history?page=${page}&limit=${limit}`);
- return data;
- },
- // 検索履歴詳細の取得
- async getHistoryDetail(id: string): Promise<SearchHistoryDetail> {
- const { data } = await apiClient.get(`/search-history/${id}`);
- return data;
- },
- // 検索履歴の作成
- async createHistory(title: string, selectedGroups?: string[]): Promise<{ id: string }> {
- const { data } = await apiClient.post(`/search-history`, { title, selectedGroups });
- return data;
- },
- // 検索履歴の削除
- async deleteHistory(id: string): Promise<void> {
- await apiClient.delete(`/search-history/${id}`);
- },
- };
|