Private
Public Access
feat: logs para cuando le volves a dar el alta a un repuesto
This commit is contained in:
1 parent
c906dd4511
commit
6d123ea01d
13 files changed
+215
-7
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { API_URL } from '$lib/env';
|
||||
import { getToken } from '../token';
|
||||
|
||||
export async function altaRepuesto(id: number) {
|
||||
try {
|
||||
const req = await fetch(`${API_URL}/repuestos/${id}/alta`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
Authorization: `Bearer ${getToken()}`
|
||||
}
|
||||
});
|
||||
if (req.ok) {
|
||||
return 'Ok';
|
||||
}
|
||||
const data = await req.json();
|
||||
return data.error;
|
||||
} catch {
|
||||
return 'no se puso alcanzar el servidor';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user