GT2/GT2-iOS/node_modules/xdl/build/Session.js.flow

26 lines
526 B
Plaintext
Raw Normal View History

2018-02-12 17:26:06 +00:00
/**
* @flow
*/
import slugid from 'slugid';
import UserSettings from './UserSettings';
function _newIdentifier(type = 'c') {
return type + '-' + slugid.v4();
}
export async function clientIdAsync() {
var clientId = await UserSettings.getAsync('accessToken', null);
if (clientId === null) {
clientId = _newIdentifier();
await setClientIdAsync(clientId);
}
return clientId;
}
export async function setClientIdAsync(token: string) {
await UserSettings.setAsync('accessToken', token);
return token;
}