Allow unpicking box, fix calendar render
This commit is contained in:
22
app/api.ts
22
app/api.ts
@@ -38,4 +38,26 @@ export const markBoxPickedUp = async (id: string) => {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export const markBoxDelivered = async (id: string) => {
|
||||
const baseUrl = "http://localhost:9090";
|
||||
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/loota/`, {
|
||||
method: 'POST',
|
||||
mode: "cors",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ id: id, pickup_date: null }),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const updatedBox = await response.json();
|
||||
return updatedBox;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user