Google_Calendar_Helpers::automator_google_calendar_process_code_callback()

Method automator_google_calendar_process_code_callback.


Description Description

A wp_ajax callback.


Top ↑

Return Return

(Uncanny_Automatorvoid.)


Source Source

File: src/integrations/google-calendar/helpers/google-calendar-helpers.php

	public function automator_google_calendar_process_code_callback() {

		// Redirect if there are any errors.
		$this->auth_redirect_when_error(
			automator_filter_input( 'nonce' ),
			automator_filter_input( 'auth_error' )
		);

		// Persist connection if okay.
		$is_connected = $this->auth_persist_connection(
			automator_filter_input( 'automator_api_message' ),
			get_transient( 'automator_api_google_authorize_nonce' )
		);

		if ( $is_connected ) {
			$this->redirect_with_success( 200 );
		}

		$this->redirect_with_error( 'generic_error' );

		wp_die();

	}