@uniai-fe/ui-legacy 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/types/index.d.ts +0 -1
- package/src/types/weather/base.d.ts +4 -0
- package/src/weather/apis/korea/server.ts +11 -7
- package/src/weather/utils/location.ts +3 -1
- package/src/types/location/geojson.d.ts +0 -59
- package/src/types/location/index.d.ts +0 -2
- package/src/types/location/region.d.ts +0 -19
package/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -27,11 +27,12 @@ import {
|
|
|
27
27
|
* 기상청 API; base URL
|
|
28
28
|
* "본 저작물은 기상청에서 'OO년'작성하여 공공누리 제1유형으로 개방한 '저작물명(작성자:OOO)'을 이용하였으며, 해당 저작물은 '기상청 API허브(apihub.kma.go.kr)에서 무료로 다운받으실 수 있습니다."
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
const API_BASE = "https://apihub.kma.go.kr";
|
|
31
32
|
/**
|
|
32
33
|
* 기상청 API; 날씨정보 URL
|
|
33
34
|
*/
|
|
34
|
-
const API_WEATHER =
|
|
35
|
+
const API_WEATHER = "/typ02/openApi/VilageFcstInfoService_2.0";
|
|
35
36
|
|
|
36
37
|
const QUERY_URL = {
|
|
37
38
|
forecast: `${API_WEATHER}/getVilageFcst`,
|
|
@@ -70,16 +71,17 @@ const getWeatherParams = ({
|
|
|
70
71
|
* @method GET
|
|
71
72
|
*/
|
|
72
73
|
export const routeWeatherKoreaNow = async ({
|
|
73
|
-
domain,
|
|
74
|
+
domain = API_BASE,
|
|
74
75
|
authKey,
|
|
75
76
|
routeUrl,
|
|
76
77
|
searchParams,
|
|
77
78
|
}: {
|
|
78
|
-
domain: string;
|
|
79
79
|
authKey: string;
|
|
80
80
|
routeUrl: string;
|
|
81
81
|
searchParams: URLSearchParams;
|
|
82
|
-
}
|
|
82
|
+
} & Partial<{
|
|
83
|
+
domain: string;
|
|
84
|
+
}>): Promise<API_Res_WeatherKoreaNow> => {
|
|
83
85
|
const NOW_DATA: API_Res_WeatherKoreaToday = {
|
|
84
86
|
...API_RES_BASE,
|
|
85
87
|
temperature: null,
|
|
@@ -129,7 +131,7 @@ export const routeWeatherKoreaNow = async ({
|
|
|
129
131
|
* @method GET
|
|
130
132
|
*/
|
|
131
133
|
export const routeWeatherKoreaForecast = async ({
|
|
132
|
-
domain,
|
|
134
|
+
domain = API_BASE,
|
|
133
135
|
authKey,
|
|
134
136
|
routeUrl,
|
|
135
137
|
searchParams,
|
|
@@ -138,7 +140,9 @@ export const routeWeatherKoreaForecast = async ({
|
|
|
138
140
|
authKey: string;
|
|
139
141
|
routeUrl: string;
|
|
140
142
|
searchParams: URLSearchParams;
|
|
141
|
-
}
|
|
143
|
+
} & Partial<{
|
|
144
|
+
domain: string;
|
|
145
|
+
}>): Promise<API_Res_WeatherKoreaForecast> => {
|
|
142
146
|
const FORECAST_DATA: API_Res_WeatherKoreaNextDays = {
|
|
143
147
|
...API_RES_BASE,
|
|
144
148
|
max_temperature: null,
|
|
@@ -126,7 +126,9 @@ export async function getWeatherGridLocation(
|
|
|
126
126
|
// 특정 위경도 좌표를 받지 못하는 경우, 현재 사용자 위치로 지정
|
|
127
127
|
if (
|
|
128
128
|
typeof window !== "undefined" &&
|
|
129
|
-
(typeof coordinate === "undefined" ||
|
|
129
|
+
(typeof coordinate === "undefined" ||
|
|
130
|
+
geo.latitude === null ||
|
|
131
|
+
geo.longitude === null)
|
|
130
132
|
) {
|
|
131
133
|
const { latitude, longitude } = await userLocation();
|
|
132
134
|
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { GeoJsonObject } from "geojson";
|
|
2
|
-
|
|
3
|
-
export type GeoCoordinate = {
|
|
4
|
-
[directionKey: string]: number | null;
|
|
5
|
-
latitude: number | null;
|
|
6
|
-
longitude: number | null;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type GeoJsonFeatureGeometryType = {
|
|
10
|
-
type: string;
|
|
11
|
-
coordinates: [number, number][][] | [number, number][];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type GeoJsonFeaturePropertiesType = {
|
|
15
|
-
[key: string]: string | number;
|
|
16
|
-
name: string;
|
|
17
|
-
base_year: string | number;
|
|
18
|
-
name_eng: string;
|
|
19
|
-
code: string | number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 지도 데이터 geojson 타입
|
|
24
|
-
*/
|
|
25
|
-
export type GeoJsonFeatureType = {
|
|
26
|
-
type: string;
|
|
27
|
-
geometry: GeoJsonFeatureGeometryType;
|
|
28
|
-
properties: GeoJsonFeaturePropertiesType;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 지도 데이터 geojson 컬렉션 타입
|
|
33
|
-
*/
|
|
34
|
-
export type GeoJsonFeatureCollectionType = GeoJsonObject & {
|
|
35
|
-
// type: string;
|
|
36
|
-
features: GeoJsonFeatureType[];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* geojson export 타입
|
|
41
|
-
*/
|
|
42
|
-
export type GeoJsonCollectionType = {
|
|
43
|
-
[key: string]: GeoJsonFeatureCollectionType;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* geojson 지역명 참조 타입
|
|
48
|
-
*/
|
|
49
|
-
export type GeoJsonNamesType = {
|
|
50
|
-
name: string;
|
|
51
|
-
base_year: string | number;
|
|
52
|
-
name_eng: string;
|
|
53
|
-
code: string | number;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type GeoJsonNamesCollectionType = {
|
|
57
|
-
[key: string]: GeoJsonNamesType[];
|
|
58
|
-
province: GeoJsonNamesType[];
|
|
59
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type CountyDataType = {
|
|
2
|
-
key: string;
|
|
3
|
-
name: string;
|
|
4
|
-
value: string;
|
|
5
|
-
province_code: number | string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type CountyCollectionType = {
|
|
9
|
-
[provinceKey: string]: CountyDataType[];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type ProvinceDataType = {
|
|
13
|
-
key: string;
|
|
14
|
-
name_full: string;
|
|
15
|
-
name_short: string;
|
|
16
|
-
eng: string;
|
|
17
|
-
value: string;
|
|
18
|
-
code: number | string;
|
|
19
|
-
};
|