Add enums, AuthService, and integrate backend registration endpoints
All checks were successful
Build frontend / build (push) Successful in 57s
All checks were successful
Build frontend / build (push) Successful in 57s
- Add separate enum files: BuildingType, PropertyStatus, BookingStatus, CommissionType, IdentityType, UserRole, City, LoginMethod, OwnerType, CustomerType - Add AuthService (addToken/getToken/deleteToken) - Update api.js: use AuthService, add Owner/Add and Customer/Add endpoints - Update login page to use AuthService for token storage - Rewrite owner register: 3-step flow with OwnerType dropdown, backend integration, OTP verification - Rewrite tenant register: 2-step flow with CustomerType dropdown, backend integration, OTP verification - Update homepage and property detail to use enums instead of hardcoded maps - Update AddPropertyForm to import from enums directly - Add console logs and status toasts linked to API response messages
This commit is contained in:
@ -1,41 +1,71 @@
|
||||
export const PROPERTY_STATUS = {
|
||||
AVAILABLE: 'available',
|
||||
BOOKED: 'booked',
|
||||
MAINTENANCE: 'maintenance'
|
||||
};
|
||||
/**
|
||||
* Constants — re-exports from enums for backward compatibility
|
||||
*
|
||||
* New code should import directly from:
|
||||
* import { BuildingType, BookingStatus, City, ... } from '@/app/enums';
|
||||
*
|
||||
* Old imports from '@/app/utils/constants' continue to work.
|
||||
*/
|
||||
|
||||
export const BOOKING_STATUS = {
|
||||
PENDING: 'pending',
|
||||
OWNER_APPROVED: 'owner_approved',
|
||||
ADMIN_APPROVED: 'admin_approved',
|
||||
REJECTED: 'rejected',
|
||||
ACTIVE: 'active',
|
||||
COMPLETED: 'completed',
|
||||
CANCELLED: 'cancelled'
|
||||
};
|
||||
// Re-export all enums
|
||||
export {
|
||||
BuildingType,
|
||||
BuildingTypeLabels,
|
||||
BuildingTypeKeys,
|
||||
BuildingTypeByKey,
|
||||
} from '../enums/BuildingType';
|
||||
|
||||
export const COMMISSION_TYPE = {
|
||||
FROM_OWNER: 'from_owner',
|
||||
FROM_TENANT: 'from_tenant',
|
||||
FROM_BOTH: 'from_both'
|
||||
};
|
||||
export {
|
||||
PropertyStatus,
|
||||
PropertyStatusLabels,
|
||||
PropertyStatusKeys,
|
||||
PropertyStatusByKey,
|
||||
} from '../enums/PropertyStatus';
|
||||
|
||||
export const IDENTITY_TYPE = {
|
||||
SYRIAN: 'syrian',
|
||||
PASSPORT: 'passport'
|
||||
};
|
||||
export {
|
||||
BookingStatus,
|
||||
BookingStatusLabels,
|
||||
BookingStatusColors,
|
||||
} from '../enums/BookingStatus';
|
||||
|
||||
export const PAYMENT_METHOD = {
|
||||
export {
|
||||
CommissionType,
|
||||
CommissionTypeLabels,
|
||||
} from '../enums/CommissionType';
|
||||
|
||||
export {
|
||||
IdentityType,
|
||||
IdentityTypeLabels,
|
||||
IdentityTypeFlags,
|
||||
} from '../enums/IdentityType';
|
||||
|
||||
export {
|
||||
UserRole,
|
||||
UserRoleLabels,
|
||||
UserRoleColors,
|
||||
} from '../enums/UserRole';
|
||||
|
||||
export {
|
||||
City,
|
||||
CitiesList,
|
||||
extractCity,
|
||||
} from '../enums/City';
|
||||
|
||||
export { LoginMethod } from '../enums/LoginMethod';
|
||||
export { OwnerType, OwnerTypeLabels } from '../enums/OwnerType';
|
||||
export { CustomerType, CustomerTypeLabels } from '../enums/CustomerType';
|
||||
|
||||
// ─── Legacy aliases (keep old imports working) ───
|
||||
export const PROPERTY_STATUS = PropertyStatusKeys;
|
||||
export const BOOKING_STATUS = BookingStatus;
|
||||
export const COMMISSION_TYPE = CommissionType;
|
||||
export const IDENTITY_TYPE = IdentityType;
|
||||
export const CITIES = City;
|
||||
|
||||
// ─── Misc constants ───
|
||||
export const PAYMENT_METHOD = Object.freeze({
|
||||
CASH: 'cash',
|
||||
ELECTRONIC: 'electronic'
|
||||
};
|
||||
ELECTRONIC: 'electronic',
|
||||
});
|
||||
|
||||
export const CITIES = {
|
||||
DAMASCUS: 'damascus',
|
||||
ALEPPO: 'aleppo',
|
||||
HOMS: 'homs',
|
||||
LATTAKIA: 'latakia',
|
||||
DARAA: 'daraa'
|
||||
};
|
||||
|
||||
export const DEFAULT_COMMISSION_RATE = 5;
|
||||
export const DEFAULT_COMMISSION_RATE = 5;
|
||||
|
||||
Reference in New Issue
Block a user