Files
ragflow/web/src/services/data-source-service.ts
Yongteng Lei d81e4095de Feat: Google drive supports web-based credentials (#11173)
### What problem does this PR solve?

 Google drive supports web-based credentials.

<img width="1204" height="612" alt="image"
src="https://github.com/user-attachments/assets/70291c63-a2dd-4a80-ae20-807fe034cdbc"
/>


### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2025-11-11 17:21:08 +08:00

43 lines
1.3 KiB
TypeScript

import api from '@/utils/api';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';
const { dataSourceSet, dataSourceList } = api;
const methods = {
dataSourceSet: {
url: dataSourceSet,
method: 'post',
},
dataSourceList: {
url: dataSourceList,
method: 'get',
},
} as const;
const dataSourceService = registerServer<keyof typeof methods>(
methods,
request,
);
export const deleteDataSource = (id: string) =>
request.post(api.dataSourceDel(id));
export const dataSourceResume = (id: string, data: { resume: boolean }) => {
return request.put(api.dataSourceResume(id), { data });
};
export const dataSourceRebuild = (id: string, data: { kb_id: string }) => {
return request.put(api.dataSourceRebuild(id), { data });
};
export const getDataSourceLogs = (id: string, params?: any) =>
request.get(api.dataSourceLogs(id), { params });
export const featchDataSourceDetail = (id: string) =>
request.get(api.dataSourceDetail(id));
export const startGoogleDriveWebAuth = (payload: { credentials: string }) =>
request.post(api.googleDriveWebAuthStart, { data: payload });
export const pollGoogleDriveWebAuthResult = (payload: { flow_id: string }) =>
request.post(api.googleDriveWebAuthResult, { data: payload });
export default dataSourceService;