@tanglemedia/svelte-starter-directus-api 4.0.1 → 4.0.2
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.
|
@@ -50,10 +50,12 @@ export class DirectusApiAdapter extends ApiAdapterAbstract {
|
|
|
50
50
|
...(search ? { search } : {}),
|
|
51
51
|
}
|
|
52
52
|
}));
|
|
53
|
+
let total = 0;
|
|
53
54
|
if (data && data.length === 1) {
|
|
54
|
-
|
|
55
|
+
const c = data[0][k];
|
|
56
|
+
total = c && typeof c === 'object' ? Number(c[f]) : Number(c);
|
|
55
57
|
}
|
|
56
|
-
return 0;
|
|
58
|
+
return isNaN(total) ? 0 : total;
|
|
57
59
|
}
|
|
58
60
|
async transformResponse(res, status = 200) {
|
|
59
61
|
return {
|
package/package.json
CHANGED
|
@@ -99,11 +99,14 @@ export class DirectusApiAdapter<
|
|
|
99
99
|
}
|
|
100
100
|
}));
|
|
101
101
|
|
|
102
|
+
let total = 0;
|
|
103
|
+
|
|
102
104
|
if (data && data.length === 1) {
|
|
103
|
-
|
|
105
|
+
const c = data[0][k];
|
|
106
|
+
total = c && typeof c === 'object' ? Number(c[f]) : Number(c);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
return 0;
|
|
109
|
+
return isNaN(total) ? 0 : total;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
async transformResponse<T, M extends object = AnyObject>(
|