HEX
Server: LiteSpeed
System: Linux server902.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: deshuvsd (2181)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //proc/thread-self/root/home/deshuvsd/public_html/wp-content/plugins/suremails/src/api/auth.js
import apiFetch from '@wordpress/api-fetch';
import { __ } from '@wordpress/i18n';

export const get_auth_url = async (
	provider,
	client_id,
	client_secret,
	redirect_url
) => {
	try {
		const response = await apiFetch( {
			path: '/suremails/v1/get-auth-url',
			method: 'POST',
			headers: {
				'X-WP-Nonce': suremails.nonce,
				'Content-Type': 'application/json',
			},
			body: JSON.stringify( {
				provider,
				client_id,
				client_secret,
				redirect_url,
			} ),
		} );
		return response;
	} catch ( error ) {
		throw new Error(
			error.message ||
				__( 'There was an issue getting the auth URL.', 'suremails' )
		);
	}
};