2023-03-03 15:23:46 +00:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2024-05-21 17:59:04 +00:00
|
|
|
import { WeatherCallbacks } from "@spt/callbacks/WeatherCallbacks";
|
|
|
|
import { RouteAction, StaticRouter } from "@spt/di/Router";
|
|
|
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
|
|
|
import { IWeatherData } from "@spt/models/eft/weather/IWeatherData";
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
@injectable()
|
2023-11-13 11:12:17 -05:00
|
|
|
export class WeatherStaticRouter extends StaticRouter
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
2023-11-13 12:31:52 -05:00
|
|
|
constructor(@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks)
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
2023-11-13 12:31:52 -05:00
|
|
|
super([
|
2024-04-28 13:45:36 +00:00
|
|
|
new RouteAction(
|
|
|
|
"/client/weather",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IWeatherData>> =>
|
|
|
|
{
|
|
|
|
return this.weatherCallbacks.getWeather(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2023-11-13 12:31:52 -05:00
|
|
|
]);
|
2023-03-03 15:23:46 +00:00
|
|
|
}
|
2023-11-13 11:12:17 -05:00
|
|
|
}
|