Files
gitlab-instance-0a899031_na…/services/ResourceService.ts
2025-11-13 05:05:53 +08:00

19 lines
501 B
TypeScript

export class ResourceService {
async addResource(resource: { path: string }) {
// Logic to add the resource, e.g., sending a request to your API
const response = await fetch('/api/resource', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(resource),
});
if (!response.ok) {
throw new Error('Failed to add resource');
}
return await response.json(); // Return the response data if needed
}
}