createSession static method
Implementation
static Future<void> createSession() async {
if (_currentLoginUser.isLoginedUser || _currentLoginUser.isGuestUser) {
final url = Uri.parse('${myConfig!.config.apiServerUrl}/createSession/');
http.Client client = http.Client();
if (client is BrowserClient) {
logger.finest('client.withCredentials');
client.withCredentials = true;
}
// <!-- http.Response response = await http.post(
http.Response response = await client.post(
url,
headers: <String, String>{
'Content-Type': 'application/x-www-form-urlencoded',
},
body: <String, String>{
'user_id': _currentLoginUser.userId,
'server_type': HycopFactory.serverType.name,
},
).catchError(
(error, stackTrace) => throw HycopUtils.getHycopException(
error: error,
defaultMessage: 'client.post(createSession) Failed !!!',
),
);
// -->
var responseBody = utf8.decode(response.bodyBytes);
var jsonData = jsonDecode(responseBody);
logger.finest('jsonData=$jsonData');
}
}