feat: port scenario 903 select-pool flow

This commit is contained in:
2026-07-30 23:27:59 +00:00
parent 9bd057456b
commit 115218ded8
80 changed files with 6859 additions and 48 deletions
+35 -2
View File
@@ -101,7 +101,7 @@ export const useSessionStore = defineStore('session', {
},
async refreshGeneralStatus() {
if (!this.gameToken) {
this.status = 'authed';
this.status = this.sessionToken ? 'authed' : 'public';
return;
}
if (!isAccessToken(this.gameToken)) {
@@ -111,11 +111,44 @@ export const useSessionStore = defineStore('session', {
return;
}
}
try {
await gameTrpc.auth.status.query();
} catch {
this.setGameToken(null);
if (this.sessionToken && this.profile) {
try {
const issued = await gatewayTrpc.auth.issueGameSession.mutate({
sessionToken: this.sessionToken,
profile: this.profile,
});
this.setGameToken(issued.gameToken);
if (await this.exchangeGatewayToken()) {
await gameTrpc.auth.status.query();
} else {
throw new Error('Game token exchange failed.');
}
} catch {
this.setGameToken(null);
this.error = 'game_session_invalid';
this.status = 'public';
return;
}
} else {
this.error = 'game_session_invalid';
this.status = 'public';
return;
}
}
try {
const lobby = await gameTrpc.lobby.info.query();
this.status = lobby.myGeneral ? 'general' : 'authed';
} catch {
this.error = 'game_status_unavailable';
this.error = 'game_lobby_unavailable';
if (this.status === 'unknown' || this.status === 'public') {
this.status = 'authed';
}
}
},
async exchangeGatewayToken(): Promise<boolean> {