Fix code quality violations for publish
Remove unused blade settings pages not linked from UI Convert remaining frontend pages to SPA actions Convert settings user_settings and general to SPA actions Convert settings profile pages to SPA actions Convert contacts and projects add/edit pages to SPA actions Convert clients add/edit page to SPA action with loading pattern Refactor component scoped IDs from $id to $sid Fix jqhtml comment syntax and implement universal error component system Update all application code to use new unified error system Remove all backwards compatibility - unified error system complete Phase 5: Remove old response classes Phase 3-4: Ajax response handler sends new format, old helpers deprecated Phase 2: Add client-side unified error foundation Phase 1: Add server-side unified error foundation Add unified Ajax error response system with constants 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1060,66 +1060,15 @@ function rsx_body_class()
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an authentication required response
|
||||
* Create a unified error response
|
||||
*
|
||||
* Returns a special response object that Dispatch and Ajax_Endpoint handle differently:
|
||||
* - HTTP requests: Sets flash alert and redirects to login
|
||||
* - AJAX requests: Returns JSON error with success:false
|
||||
*
|
||||
* @param string $reason The reason authentication is required
|
||||
* @param string|null $redirect The URL to redirect to (default: /login)
|
||||
* @return \App\RSpade\Core\Response\Auth_Required_Response
|
||||
* @param string $error_code One of Ajax::ERROR_* constants
|
||||
* @param string|array|null $metadata Error message (string) or structured data (array)
|
||||
* @return \App\RSpade\Core\Response\Error_Response
|
||||
*/
|
||||
function response_auth_required($reason = 'Authentication Required', $redirect = '/login')
|
||||
function response_error(string $error_code, $metadata = null)
|
||||
{
|
||||
return new \App\RSpade\Core\Response\Auth_Required_Response($reason, $redirect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an unauthorized response
|
||||
*
|
||||
* Returns a special response object that Dispatch and Ajax_Endpoint handle differently:
|
||||
* - HTTP requests: Sets flash alert and redirects or throws exception
|
||||
* - AJAX requests: Returns JSON error with success:false
|
||||
*
|
||||
* @param string $reason The reason for unauthorized access
|
||||
* @param string|null $redirect The URL to redirect to (null throws exception)
|
||||
* @return \App\RSpade\Core\Response\Unauthorized_Response
|
||||
*/
|
||||
function response_unauthorized($reason = 'Unauthorized', $redirect = null)
|
||||
{
|
||||
return new \App\RSpade\Core\Response\Unauthorized_Response($reason, $redirect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a form error response
|
||||
*
|
||||
* Returns a special response object that Dispatch and Ajax_Endpoint handle differently:
|
||||
* - HTTP requests: Sets flash alert and redirects back to same URL as GET
|
||||
* - AJAX requests: Returns JSON error with success:false and details
|
||||
*
|
||||
* @param string $reason The error message
|
||||
* @param array $details Additional error details
|
||||
* @return \App\RSpade\Core\Response\Form_Error_Response
|
||||
*/
|
||||
function response_form_error($reason = 'An error has occurred.', $details = [])
|
||||
{
|
||||
return new \App\RSpade\Core\Response\Form_Error_Response($reason, $details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fatal error response
|
||||
*
|
||||
* Returns a special response object that always throws an exception
|
||||
* in both HTTP and AJAX contexts
|
||||
*
|
||||
* @param string $reason The error message
|
||||
* @param array $details Additional error details
|
||||
* @return \App\RSpade\Core\Response\Fatal_Error_Response
|
||||
*/
|
||||
function response_fatal_error($reason = 'An error has occurred.', $details = [])
|
||||
{
|
||||
return new \App\RSpade\Core\Response\Fatal_Error_Response($reason, $details);
|
||||
return new \App\RSpade\Core\Response\Error_Response($error_code, $metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user