Default host to user name
This commit is contained in:
parent
0e15a586e6
commit
b2e9666b18
1 changed files with 3 additions and 2 deletions
|
|
@ -486,9 +486,10 @@ export const useGame = (defaultGameConfig?: GameConfig) => {
|
||||||
storeSession({ pin, role: 'HOST', hostSecret: secret });
|
storeSession({ pin, role: 'HOST', hostSecret: secret });
|
||||||
|
|
||||||
if (hostParticipates) {
|
if (hostParticipates) {
|
||||||
|
const defaultHostName = auth.user?.profile?.preferred_username || auth.user?.profile?.name || 'Host';
|
||||||
const hostPlayer: Player = {
|
const hostPlayer: Player = {
|
||||||
id: 'host',
|
id: 'host',
|
||||||
name: 'Host',
|
name: defaultHostName,
|
||||||
score: 0,
|
score: 0,
|
||||||
previousScore: 0,
|
previousScore: 0,
|
||||||
streak: 0,
|
streak: 0,
|
||||||
|
|
@ -501,7 +502,7 @@ export const useGame = (defaultGameConfig?: GameConfig) => {
|
||||||
};
|
};
|
||||||
setPlayers([hostPlayer]);
|
setPlayers([hostPlayer]);
|
||||||
setCurrentPlayerId('host');
|
setCurrentPlayerId('host');
|
||||||
setCurrentPlayerName('Host');
|
setCurrentPlayerName(defaultHostName);
|
||||||
} else {
|
} else {
|
||||||
setPlayers([]);
|
setPlayers([]);
|
||||||
setCurrentPlayerId(null);
|
setCurrentPlayerId(null);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue