21 lines
599 B
TypeScript
21 lines
599 B
TypeScript
import { RentPayment } from '../services/rent-payment.service';
|
|
|
|
export const RENT_PAYMENT_DATA_STALE = 'RENT_PAYMENT_DATA_STALE';
|
|
const CONCURRENT_CHANGE = 'concurrent_change';
|
|
|
|
export type RentPaymentDialogResult = RentPayment | typeof RENT_PAYMENT_DATA_STALE;
|
|
|
|
export function isRentPaymentDataStale(error: unknown): boolean {
|
|
return (
|
|
typeof error === 'object' &&
|
|
error !== null &&
|
|
'status' in error &&
|
|
error.status === 409 &&
|
|
'error' in error &&
|
|
typeof error.error === 'object' &&
|
|
error.error !== null &&
|
|
'code' in error.error &&
|
|
error.error.code === CONCURRENT_CHANGE
|
|
);
|
|
}
|