30 lines
875 B
JavaScript
30 lines
875 B
JavaScript
import api from './api';
|
|
|
|
export const lockerService = {
|
|
registerLockers: async (cabinetId, lockers) => {
|
|
return api.post('/cabinet', {
|
|
cabinetId,
|
|
lockers: lockers.map(({ id, size, keyId }) => ({
|
|
id,
|
|
size,
|
|
keyId
|
|
}))
|
|
});
|
|
},
|
|
|
|
changeLockerStatus: async (cabinetId, lockerId, status) => {
|
|
return api.patch(`/locker/status`, { cabinetId, lockerId, status });
|
|
},
|
|
|
|
keySwap: async (cabinetId, lockerId, reason, oldKey, newKey) => {
|
|
return api.patch(`/locker/key`, { cabinetId, lockerId, reason, oldKey, newKey });
|
|
},
|
|
|
|
updateCharges: async (productCode, interestCategory, rent, penalty) => {
|
|
return api.patch(`/charge/${productCode}${interestCategory}`, { rent, penalty });
|
|
},
|
|
|
|
getCharges: async (productCode, interestCategory) => {
|
|
return api.get(`/charge/${productCode}${interestCategory}`);
|
|
}
|
|
}; |