PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.14.1
Yatra – Travel Booking & Tour Operator Software v3.0.14.1
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / resources / js / lib / unwrap-api-payload.ts

unwrap-api-payload.ts in Yatra – Travel Booking & Tour Operator Software 3.0.14.1, at resources/js/lib/unwrap-api-payload.ts

14 lines 403 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Normalize REST JSON that may be either a plain payload (e.g. settings)
3 * or wrapped as { success: true, data: T } (e.g. Email Automation).
4 */
5 export function unwrapApiPayload<T>(raw: unknown): T {
6 if (raw !== null && typeof raw === "object") {
7 const r = raw as Record<string, unknown>;
8 if (r.success === true && "data" in r) {
9 return r.data as T;
10 }
11 }
12 return raw as T;
13 }
14