A React Native plugin for interfacing SAP Customer Data Cloud. The plugin provides quick access to core elements & business API flows available within the SAP Customer Data Cloud designed for React Native mobile application.
Apache License 2.0
14
stars
11
forks
source link
The `getAccount` and `getSession` methods don't return a JSON dictionary, but rather a JSON string #31
Although the function definition of the Gigya.getAccount() and Gigya.getSession() methods have a TypeScript return type which defines that we should expect a GigyaDictionary (which is just a Record<>) or plain JS object, it instead returns a serialized JSON string.
getAccount(params?: Record<string, any>): Promise<GigyaDictionary>; // <- return type is incorrect
...
function getSession(): Promise<null | {sessionToken: string, sessionSecret: string, expirationTime: number}>;
This implies that we explicitly have to parse the response to a JSON dictionary using JSON.parse().
It would be better if the methods, in line with its definition, always returned a JSON dictionary object directly.
Given that these two methods return strings instead of JS objects... I suspect that this might be an issue with other methods as well?
Although the function definition of the
Gigya.getAccount()
andGigya.getSession()
methods have a TypeScript return type which defines that we should expect aGigyaDictionary
(which is just aRecord<>
) or plain JS object, it instead returns a serialized JSON string.This implies that we explicitly have to parse the response to a JSON dictionary using
JSON.parse()
.It would be better if the methods, in line with its definition, always returned a JSON dictionary object directly.
Given that these two methods return strings instead of JS objects... I suspect that this might be an issue with other methods as well?