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

26 lines
526 B
Plaintext

/**
* @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;
}