@@ -26,7 +26,7 @@ import {
2626import { flattenedNodes , planetJunctionsMap } from "../utils/nodes" ;
2727import { createWithEqualityFn } from "zustand/traditional" ;
2828import { shallow } from "zustand/shallow" ;
29- import { getGameProfile } from "../utils/profile" ;
29+ import { getGameProfile , getUsernameFromProfile } from "../utils/profile" ;
3030import { assignGroup } from "../utils/hash" ;
3131
3232export const useStore = createWithEqualityFn (
@@ -557,10 +557,7 @@ export const useStore = createWithEqualityFn(
557557 )
558558 return ;
559559
560- const accountUsername = gameProfile . DisplayName . slice (
561- 0 ,
562- gameProfile . DisplayName . length - 1
563- ) ;
560+ const accountUsername = getUsernameFromProfile ( gameProfile ) ;
564561 if ( accountUsername !== gameSyncUsername ) {
565562 set ( { gameSyncUsername : accountUsername } ) ;
566563 updateFirestore ( {
@@ -656,10 +653,7 @@ export const useStore = createWithEqualityFn(
656653 enableGameSync : async ( accountId , platform ) => {
657654 const response = await getGameProfile ( accountId , platform ) ;
658655 const gameProfile = response ?. Results ?. [ 0 ] ;
659- const accountUsername = gameProfile . DisplayName . slice (
660- 0 ,
661- gameProfile . DisplayName . length - 1
662- ) ;
656+ const accountUsername = getUsernameFromProfile ( gameProfile ) ;
663657
664658 get ( ) . updateFirestore ( {
665659 gameSyncUsername : accountUsername ,
0 commit comments