fix for work in progress modal when augmenting

* added an early out to turns a basic error for the work modal when the current work faction to show the faction or faction not found
This commit is contained in:
phyzical 2022-03-05 13:05:37 +08:00
parent fb4812b530
commit a389b515df

@ -34,6 +34,18 @@ export function WorkInProgressRoot(): React.ReactElement {
const player = use.Player(); const player = use.Player();
const router = use.Router(); const router = use.Router();
const faction = Factions[player.currentWorkFactionName]; const faction = Factions[player.currentWorkFactionName];
if (!faction) {
return (
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>
<Grid item>
<Typography>
Sorry, Something has gone wrong you cannot work for {player.currentWorkFactionName || "(Faction not found)"} at this time
</Typography>
</Grid>
</Grid>
)
}
if (player.workType == CONSTANTS.WorkTypeFaction) { if (player.workType == CONSTANTS.WorkTypeFaction) {
function cancel(): void { function cancel(): void {
router.toFaction(faction); router.toFaction(faction);