's'
This commit is contained in:
18
services/ResourceService.ts
Normal file
18
services/ResourceService.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user