asdasd
This commit is contained in:
@@ -73,17 +73,12 @@ final class Router
|
||||
if ($path === 'v1/refresh' && $method === 'POST') {
|
||||
$input = $this->input();
|
||||
$base = $this->stringOrNull($input['base'] ?? null);
|
||||
$currencies = $this->parseCsv($input['currencies'] ?? null);
|
||||
if ($currencies === null) {
|
||||
$settings = module_fn('fx-rates', 'settings');
|
||||
$currencies = is_array($settings['preferred_currencies'] ?? null) ? $settings['preferred_currencies'] : null;
|
||||
}
|
||||
$force = !empty($input['force']);
|
||||
$maxAgeHours = is_numeric($input['max_age_hours'] ?? null) ? (float) $input['max_age_hours'] : 24.0;
|
||||
|
||||
$result = $force
|
||||
? $this->service->refreshLatestRates($currencies, $base)
|
||||
: $this->service->ensureFreshLatestRates($maxAgeHours, $base, $currencies);
|
||||
? $this->service->refreshLatestRates(null, $base)
|
||||
: $this->service->ensureFreshLatestRates($maxAgeHours, $base, null);
|
||||
|
||||
$this->respond(['data' => $result], 201);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user