feat: [juil] 건설PMIS 날씨 위젯 WeatherService API 연동
- 기존 대시보드 WeatherService를 활용한 JSON API 추가 - React 날씨 위젯에서 /juil/construction-pmis/weather 호출 - 기상청 API 기반 오늘/내일 날씨, 기온, 강수확률 표시 - Blade weather-icon과 동일한 SVG 아이콘 React 컴포넌트 구현
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace App\Http\Controllers\Juil;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\WeatherService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\View\View;
|
||||
@@ -44,4 +46,11 @@ public function constructionPmis(Request $request): View|Response
|
||||
|
||||
return view('juil.construction-pmis');
|
||||
}
|
||||
|
||||
public function pmisWeather(WeatherService $weatherService): JsonResponse
|
||||
{
|
||||
$forecasts = $weatherService->getWeeklyForecast();
|
||||
|
||||
return response()->json(['forecasts' => array_slice($forecasts, 0, 2)]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user