Private
Public Access
18 lines
483 B
TypeScript
18 lines
483 B
TypeScript
import { API_URL } from '$lib/env';
|
|
import { getToken } from '../token';
|
|
|
|
export async function ajustarStock(body: any) {
|
|
try {
|
|
const req = await fetch(`${API_URL}/stock/ajustes`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}` },
|
|
body: JSON.stringify(body)
|
|
});
|
|
const data = await req.json();
|
|
if (req.ok) return data;
|
|
return data.error ?? 'error';
|
|
} catch {
|
|
return 'no se pudo alcanzar el servidor';
|
|
}
|
|
}
|