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:
26
app/enums/UserRole.js
Normal file
26
app/enums/UserRole.js
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* UserRole Enum
|
||||
* User account roles in the system
|
||||
* Used in: JWT payload, registration, routing
|
||||
*/
|
||||
const UserRole = Object.freeze({
|
||||
OWNER: 'owner',
|
||||
TENANT: 'tenant',
|
||||
ADMIN: 'admin',
|
||||
});
|
||||
|
||||
// Map role → Arabic label
|
||||
const UserRoleLabels = Object.freeze({
|
||||
[UserRole.OWNER]: 'مالك عقار',
|
||||
[UserRole.TENANT]: 'مستأجر',
|
||||
[UserRole.ADMIN]: 'مدير النظام',
|
||||
});
|
||||
|
||||
// Map role → color theme (used in UI)
|
||||
const UserRoleColors = Object.freeze({
|
||||
[UserRole.OWNER]: 'amber',
|
||||
[UserRole.TENANT]: 'blue',
|
||||
[UserRole.ADMIN]: 'red',
|
||||
});
|
||||
|
||||
export { UserRole, UserRoleLabels, UserRoleColors };
|
||||
Reference in New Issue
Block a user