@tpzdsp/next-toolkit 1.4.1 → 1.4.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/assets/styles/ol.css +2 -1
- package/src/map/MapComponent.tsx +0 -3
- package/src/types/api.ts +1 -1
- package/src/utils/http.ts +1 -12
package/package.json
CHANGED
package/src/assets/styles/ol.css
CHANGED
package/src/map/MapComponent.tsx
CHANGED
|
@@ -19,7 +19,6 @@ export type MapComponentProps = {
|
|
|
19
19
|
geocoderUrl: string;
|
|
20
20
|
basePath: string;
|
|
21
21
|
isLoading?: boolean;
|
|
22
|
-
error?: Error;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
const positionTransforms: Record<PopupDirection, string> = {
|
|
@@ -48,9 +47,7 @@ export const MapComponent = ({
|
|
|
48
47
|
geocoderUrl,
|
|
49
48
|
basePath,
|
|
50
49
|
isLoading,
|
|
51
|
-
error,
|
|
52
50
|
}: MapComponentProps) => {
|
|
53
|
-
console.log('ERROR: ', error);
|
|
54
51
|
const [popupFeatures, setPopupFeatures] = useState([]);
|
|
55
52
|
const [popupCoordinate, setPopupCoordinate] = useState<number[] | null>(null);
|
|
56
53
|
const [popupPositionClass, setPopupPositionClass] = useState<PopupDirection>('bottom-right');
|
package/src/types/api.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type PaginatedResponse<T = unknown> = {
|
|
|
19
19
|
|
|
20
20
|
// Since we only ever fetch a single API we don't need multiple failure types,
|
|
21
21
|
// so defining a global one as the default is fine. This can be changed per-app.
|
|
22
|
-
export type ApiFailure = { message: string; status?: number; code?: string;
|
|
22
|
+
export type ApiFailure = { message: string; status?: number; code?: string; detail: string };
|
|
23
23
|
|
|
24
24
|
type GenericResponse<Ok, Error> =
|
|
25
25
|
| ({
|
package/src/utils/http.ts
CHANGED
|
@@ -128,21 +128,10 @@ const post = <Ok, Error = ApiFailure>(
|
|
|
128
128
|
body: unknown,
|
|
129
129
|
options?: RequestInit,
|
|
130
130
|
): Promise<Response<Ok, Error>> => {
|
|
131
|
-
let requestBody: string;
|
|
132
|
-
|
|
133
|
-
// If body is an empty object, send an empty string
|
|
134
|
-
if (body && typeof body === 'object' && !Array.isArray(body) && Object.keys(body).length === 0) {
|
|
135
|
-
requestBody = '';
|
|
136
|
-
} else if (body === undefined || body === null) {
|
|
137
|
-
requestBody = '';
|
|
138
|
-
} else {
|
|
139
|
-
requestBody = JSON.stringify(body);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
131
|
const requestOptions = {
|
|
143
132
|
...options,
|
|
144
133
|
method: HttpMethod.Post,
|
|
145
|
-
body:
|
|
134
|
+
body: JSON.stringify(body),
|
|
146
135
|
headers: {
|
|
147
136
|
'Content-Type': MimeTypes.Json,
|
|
148
137
|
...options?.headers,
|