7
7
using LootLockerAdmin ;
8
8
using Unity . EditorCoroutines . Editor ;
9
9
10
- /// <summary>
11
- /// made for admin, relay on editing coroutines
12
- /// </summary>
13
- public class AdminServerAPI : BaseServerAPI
10
+ namespace LootLockerAdmin
14
11
{
15
- public new static AdminServerAPI I ;
16
-
17
- public static void Init ( )
12
+ /// <summary>
13
+ /// made for admin, relay on editing coroutines
14
+ /// </summary>
15
+ public class AdminServerAPI : BaseServerAPI
18
16
{
19
- I = new AdminServerAPI ( ) ;
17
+ public new static AdminServerAPI I ;
20
18
21
- BaseServerAPI . Init ( I ) ;
19
+ public static void Init ( )
20
+ {
21
+ I = new AdminServerAPI ( ) ;
22
22
23
- I . StartCoroutine = EditorCoroutineUtility . StartCoroutineOwnerless ;
24
- }
23
+ BaseServerAPI . Init ( I ) ;
25
24
26
- protected override void RefreshTokenAndCompleteCall ( ServerRequest cacheServerRequest , Action < LootLockerResponse > OnServerResponse )
27
- {
28
- var authRequest = new InitialAuthRequest ( ) ;
29
- authRequest . email = activeConfig . email ;
30
- authRequest . password = activeConfig . password ;
25
+ I . StartCoroutine = EditorCoroutineUtility . StartCoroutineOwnerless ;
26
+ }
31
27
32
- LootLockerAPIManagerAdmin . InitialAuthenticationRequest ( authRequest , ( response ) =>
28
+ protected override void RefreshTokenAndCompleteCall ( ServerRequest cacheServerRequest , Action < LootLockerResponse > OnServerResponse )
33
29
{
34
- if ( response . success )
30
+ var authRequest = new InitialAuthRequest ( ) ;
31
+ authRequest . email = activeConfig . email ;
32
+ authRequest . password = activeConfig . password ;
33
+
34
+ LootLockerAPIManagerAdmin . InitialAuthenticationRequest ( authRequest , ( response ) =>
35
35
{
36
- Dictionary < string , string > headers = new Dictionary < string , string > ( ) ;
37
- headers . Add ( "x-auth-token" , activeConfig . token ) ;
38
- cacheServerRequest . extraHeaders = headers ;
39
- if ( cacheServerRequest . retryCount < 4 )
36
+ if ( response . success )
40
37
{
41
- SendRequest ( cacheServerRequest , OnServerResponse ) ;
42
- cacheServerRequest . retryCount ++ ;
38
+ Dictionary < string , string > headers = new Dictionary < string , string > ( ) ;
39
+ headers . Add ( "x-auth-token" , activeConfig . token ) ;
40
+ cacheServerRequest . extraHeaders = headers ;
41
+ if ( cacheServerRequest . retryCount < 4 )
42
+ {
43
+ SendRequest ( cacheServerRequest , OnServerResponse ) ;
44
+ cacheServerRequest . retryCount ++ ;
45
+ }
46
+ else
47
+ {
48
+ LootLockerSDKAdminManager . DebugMessage ( "Admin token refresh failed" ) ;
49
+ LootLockerResponse res = new LootLockerResponse ( ) ;
50
+ res . statusCode = 401 ;
51
+ res . Error = "Admin token Expired" ;
52
+ res . hasError = true ;
53
+ OnServerResponse ? . Invoke ( res ) ;
54
+ }
43
55
}
44
56
else
45
57
{
46
- LootLockerSDKAdminManager . DebugMessage ( "Admin token refresh failed" ) ;
58
+ LootLockerSDKAdminManager . DebugMessage ( "Admin token refresh failed" , true ) ;
47
59
LootLockerResponse res = new LootLockerResponse ( ) ;
48
60
res . statusCode = 401 ;
49
61
res . Error = "Admin token Expired" ;
50
62
res . hasError = true ;
51
63
OnServerResponse ? . Invoke ( res ) ;
52
64
}
53
- }
54
- else
55
- {
56
- LootLockerSDKAdminManager . DebugMessage ( "Admin token refresh failed" , true ) ;
57
- LootLockerResponse res = new LootLockerResponse ( ) ;
58
- res . statusCode = 401 ;
59
- res . Error = "Admin token Expired" ;
60
- res . hasError = true ;
61
- OnServerResponse ? . Invoke ( res ) ;
62
- }
63
- } ) ;
65
+ } ) ;
66
+ }
64
67
}
65
- }
68
+ }
0 commit comments