<?php defined('ABSPATH') OR die('Access denied!');
/**
 * Called by ajax.
 * @return success message on update option
 */
 function o365_action_wp_ajax_o365_base_plugin_refresh_token_button(){
	$access_token = $_POST["access_token"];
	$refresh_token = $_POST["refresh_token"];
	$expiry_time = $_POST["expiry_time"];
	if($access_token != "")
	{
		$o365_settings = get_site_option('o365_settings'); // get setting option
		if ( is_multisite() && isset($o365_settings['shared_settings']) && $o365_settings['shared_settings'] == "yes")
		{
			delete_site_option($access_token);
			delete_site_option($refresh_token);
			delete_site_option($expiry_time);			
		}
		else
		{
			delete_option($access_token);
			delete_option($refresh_token);
			delete_option($expiry_time);
		}
		
		wp_send_json_success( 1 );
	}
}