Skip to content

Commit

Permalink
Merge pull request #66 from newfold-labs/fix/error-state
Browse files Browse the repository at this point in the history
Sitegen: Add helper function for resetting error state
  • Loading branch information
arunshenoy99 authored Apr 8, 2024
2 parents bbf5397 + 3949a08 commit d686051
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions includes/Services/FlowService.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public static function get_data() {
$result = self::get_default_data();
self::update_data_in_wp_option( $result );
}

$result = SiteGenService::reset_error_status( $result );

return $result;
}

Expand Down
14 changes: 14 additions & 0 deletions includes/Services/SiteGenService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1215,4 +1215,18 @@ public static function sync_flow_data( $updated_data ) {
$data['sitegen']['homepages']['data'] = $updated_data;
FlowService::update_data_in_wp_option( $data );
}

/**
* Reset the error status in the flow data.
*
* @param array $data The flow data.
* @return array
*/
public static function reset_error_status( $data ) {
if ( isset( $data['sitegen']['siteGenErrorStatus'] ) && true === $data['sitegen']['siteGenErrorStatus'] ) {
$data['sitegen']['siteGenErrorStatus'] = false;
}

return $data;
}
}

0 comments on commit d686051

Please sign in to comment.