This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; | |
use Analytics; | |
use Config; | |
use Illuminate\Support\Facades\App; | |
use Spatie\Analytics\Period; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This code retrieves course data from an external API and displays it in the user's | |
* My Account area. A merchant has noticed that there's a delay when loading the page. | |
* | |
* 1) What changes would you suggest to reduce or remove that delay? | |
* I've refactored it to retrieve the data from the API using AJAX, so that this does not block the page. | |
* | |
* 2) Is there any other code changes that you would make? | |
* I'd also make the AJAX call secure (nonce) and move the JS and HTML to separate files |
NewerOlder