@@ -34,34 +34,35 @@ public function render(): View
34
34
$ color = 'is-dark ' ;
35
35
$ message = 'Profile was recently updated. Check back soon. ' ;
36
36
} else {
37
- if ($ this ->runUpdate ) {
38
- try {
39
- DB ::transaction (function () use ($ cacheKey ) {
40
- $ cooldownMinutes = (int ) config ('services.halodotapi.cooldown ' );
37
+ if (! $ this ->runUpdate ) {
38
+ return view ('livewire.update-player-panel ' , [
39
+ 'color ' => 'is-info ' ,
40
+ 'message ' => 'Checking for updated stats. '
41
+ ]);
42
+ }
43
+
44
+ try {
45
+ DB ::transaction (function () use ($ cacheKey ) {
46
+ $ cooldownMinutes = (int )config ('services.halodotapi.cooldown ' );
41
47
42
- $ this ->player ->updateFromHaloDotApi ();
48
+ $ this ->player ->updateFromHaloDotApi ();
49
+ if (empty ($ this ->player ->xuid )) {
50
+ $ this ->player ->syncXuidFromXboxApi ();
51
+ $ this ->player ->saveOrFail ();
52
+ }
43
53
44
- // For some accounts, we don't have an xuid. We will grab them with this fallback
45
- if (empty ($ this ->player ->xuid )) {
46
- $ this ->player ->syncXuidFromXboxApi ();
47
- $ this ->player ->saveOrFail ();
48
- }
49
- Cache::put ($ cacheKey , true , now ()->addMinutes ($ cooldownMinutes ));
50
- $ this ->emitToRespectiveComponent ();
51
- });
52
- } catch (RequestException $ exception ) {
53
- $ color = 'is-danger ' ;
54
- $ message = $ exception ->getCode () === 429
55
- ? 'Rate Limit Hit :( - Try later. '
56
- : 'Oops - something went wrong. ' ;
57
- } catch (\Throwable $ exception ) {
58
- Log::error ($ exception ->getMessage ());
59
- $ color = 'is-danger ' ;
60
- $ message = 'Oops - something went wrong. ' ;
61
- }
62
- } else {
63
- $ color = 'is-info ' ;
64
- $ message = 'Checking for updated stats. ' ;
54
+ Cache::put ($ cacheKey , true , now ()->addMinutes ($ cooldownMinutes ));
55
+ $ this ->emitToRespectiveComponent ();
56
+ });
57
+ } catch (RequestException $ exception ) {
58
+ $ color = 'is-danger ' ;
59
+ $ message = $ exception ->getCode () === 429
60
+ ? 'Rate Limit Hit :( - Try later. '
61
+ : 'Oops - something went wrong. ' ;
62
+ } catch (\Throwable $ exception ) {
63
+ Log::error ($ exception ->getMessage ());
64
+ $ color = 'is-danger ' ;
65
+ $ message = 'Oops - something went wrong. ' ;
65
66
}
66
67
}
67
68
0 commit comments