added error handling to extract_auth_token workflow

This commit is contained in:
Valmo Trindade
2024-09-19 00:49:00 -03:00
parent 39ffb21721
commit 5c49a26aa4
4 changed files with 61 additions and 19 deletions

View File

@@ -4,9 +4,9 @@ private _atak_server_instance_password = missionNamespace getVariable "_atak_ser
private _authentication = [_atak_server_instance, _atak_server_instance_username, _atak_server_instance_password];
_atak_server_instance_token = ("armatak" callExtension ["get_auth_token", _authentication]) select 0;
_atak_server_instance_token = ("armatak" callExtension ["get_auth_token", [_authentication]]) select 0;
if ((_atak_server_instance_token != "") and !(["error", _atak_server_instance_token, false] call BIS_fnc_inString)) then {
if ((_atak_server_instance_token != "") and !(["ERROR", _atak_server_instance_token, false] call BIS_fnc_inString)) then {
missionNamespace setVariable ["_atak_server_instance_token", _atak_server_instance_token];
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Authorized"];

View File

@@ -19,16 +19,17 @@ if (isServer && _activated) exitWith {
missionNamespace setVariable ["_atak_server_instance_username", _atak_ots_api_username];
missionNamespace setVariable ["_atak_server_instance_password", _atak_ots_api_password];
/*
_atak_server_instance_token = call armatak_fnc_extract_auth_token;
_atak_server_instance_token = call armatak_fnc_extract_auth_token;
if (_atak_server_instance_token == "") then {
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Connection Failed"];
[[_warning, 2]] call CBA_fnc_notify;
} else {
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
[[_warning, 2]] call CBA_fnc_notify;
};
if (_atak_server_instance_token == "") then {
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Connection Failed"];
[[_warning, 2]] call CBA_fnc_notify;
} else {
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
[[_warning, 2]] call CBA_fnc_notify;
};
/*
if (isMultiplayer) then {
[{