полный рефакторинг всей системы
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
25
src/services/sourceService.js
Normal file
25
src/services/sourceService.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { api8001 } from './api.js'
|
||||
|
||||
export async function fetchCategories() {
|
||||
const { data } = await api8001.get('/categories_promt')
|
||||
return data ?? []
|
||||
}
|
||||
|
||||
export async function fetchSources(category = 'all') {
|
||||
const { data } = await api8001.get('/all_sources', {
|
||||
params: { category },
|
||||
})
|
||||
return data.sources ?? []
|
||||
}
|
||||
|
||||
export async function addSource(url, prompt) {
|
||||
await api8001.post('/add_sources', { url, promt: prompt })
|
||||
}
|
||||
|
||||
export async function deleteSource(url) {
|
||||
await api8001.delete('/delete_sources', { params: { url } })
|
||||
}
|
||||
|
||||
export async function startSourceParsing(url, prompt) {
|
||||
await api8001.post('/parser_all', { url, promt: prompt })
|
||||
}
|
||||
Reference in New Issue
Block a user