mirror of
https://github.com/cuigh/swirl
synced 2025-06-26 18:16:50 +00:00
40 lines
780 B
TypeScript
40 lines
780 B
TypeScript
import ajax, { Result } from './ajax'
|
|
|
|
export interface Registry {
|
|
id: string;
|
|
name: string;
|
|
url: string;
|
|
username: string;
|
|
password: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
createdBy: {
|
|
id: string;
|
|
name: string;
|
|
};
|
|
updatedBy: {
|
|
id: string;
|
|
name: string;
|
|
};
|
|
}
|
|
|
|
export class RegistryApi {
|
|
find(id: string) {
|
|
return ajax.get<Registry>('/registry/find', { id })
|
|
}
|
|
|
|
search() {
|
|
return ajax.get<Registry[]>('/registry/search')
|
|
}
|
|
|
|
save(registry: Registry) {
|
|
return ajax.post<Result<Object>>('/registry/save', registry)
|
|
}
|
|
|
|
delete(id: string) {
|
|
return ajax.post<Result<Object>>('/registry/delete', { id })
|
|
}
|
|
}
|
|
|
|
export default new RegistryApi
|