update
This commit is contained in:
@ -53,7 +53,15 @@ export function mergeRouteConfigs(
|
||||
if (overrideRoute.action) {
|
||||
// If action types are different, replace the entire action
|
||||
if (overrideRoute.action.type && overrideRoute.action.type !== mergedRoute.action.type) {
|
||||
mergedRoute.action = JSON.parse(JSON.stringify(overrideRoute.action));
|
||||
// Handle socket handler specially since it's a function
|
||||
if (overrideRoute.action.type === 'socket-handler' && overrideRoute.action.socketHandler) {
|
||||
mergedRoute.action = {
|
||||
type: 'socket-handler',
|
||||
socketHandler: overrideRoute.action.socketHandler
|
||||
};
|
||||
} else {
|
||||
mergedRoute.action = JSON.parse(JSON.stringify(overrideRoute.action));
|
||||
}
|
||||
} else {
|
||||
// Otherwise merge the action properties
|
||||
mergedRoute.action = { ...mergedRoute.action };
|
||||
@ -74,7 +82,10 @@ export function mergeRouteConfigs(
|
||||
};
|
||||
}
|
||||
|
||||
// No special merging needed for socket handlers - they are functions
|
||||
// Handle socket handler update
|
||||
if (overrideRoute.action.socketHandler) {
|
||||
mergedRoute.action.socketHandler = overrideRoute.action.socketHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ export function validateRouteAction(action: IRouteAction): { valid: boolean; err
|
||||
// Validate action type
|
||||
if (!action.type) {
|
||||
errors.push('Action type is required');
|
||||
} else if (!['forward', 'redirect', 'static', 'block'].includes(action.type)) {
|
||||
} else if (!['forward', 'socket-handler'].includes(action.type)) {
|
||||
errors.push(`Invalid action type: ${action.type}`);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user