scouting: Re-authorize users when their auth expires

A few students noted at the San Francisco regional that they get 401
errors when trying to submit scouting data. I'm not entirely convinced
how to fix that, but this patch attempts to implement a work around.

Whenever a user tries to submit data, we check for the resulting
status code. If the code is 401, then the app now opens a new tab in
an attempt to re-authorize. The tab will close itself. When the tab
closes, the app will attempt to submit the scouting data again.

Change-Id: I3a4273c9c0f571f68332877f744c9c7013a7e66a
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index cd59884..41f492c 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -33,7 +33,10 @@
   ActionT,
 } from '@org_frc971/scouting/webserver/requests/messages/submit_2024_actions_generated';
 import {Match} from '@org_frc971/scouting/webserver/requests/messages/request_all_matches_response_generated';
-import {MatchListRequestor} from '@org_frc971/scouting/www/rpc';
+import {
+  MatchListRequestor,
+  ActionsSubmitter,
+} from '@org_frc971/scouting/www/rpc';
 import {ActionHelper, ConcreteAction} from './action_helper';
 import * as pako from 'pako';
 
@@ -139,7 +142,10 @@
   qrCodeValuePieces: string[] = [];
   qrCodeValueIndex: number = 0;
 
-  constructor(private readonly matchListRequestor: MatchListRequestor) {}
+  constructor(
+    private readonly matchListRequestor: MatchListRequestor,
+    private readonly actionsSubmitter: ActionsSubmitter
+  ) {}
 
   ngOnInit() {
     this.actionHelper = new ActionHelper(
@@ -366,10 +372,7 @@
   }
 
   async submit2024Actions() {
-    const res = await fetch('/requests/submit/submit_2024_actions', {
-      method: 'POST',
-      body: this.createActionsBuffer(),
-    });
+    const res = await this.actionsSubmitter.submit(this.createActionsBuffer());
 
     if (res.ok) {
       // We successfully submitted the data. Report success.