Don't crash when loading parties without jobs
This commit is contained in:
parent
47f41a19a0
commit
b0b0219896
1 changed files with 3 additions and 6 deletions
|
|
@ -8,9 +8,7 @@ import { appState } from '~utils/appState'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
interface Props {
|
interface Props {}
|
||||||
currentJob?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const JobSection = (props: Props) => {
|
const JobSection = (props: Props) => {
|
||||||
const [job, setJob] = useState<Job>()
|
const [job, setJob] = useState<Job>()
|
||||||
|
|
@ -28,8 +26,7 @@ const JobSection = (props: Props) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (job)
|
if (job) appState.party.job = job
|
||||||
appState.party.job = job
|
|
||||||
}, [job])
|
}, [job])
|
||||||
|
|
||||||
function receiveJob(job?: Job) {
|
function receiveJob(job?: Job) {
|
||||||
|
|
@ -57,7 +54,7 @@ const JobSection = (props: Props) => {
|
||||||
<div className="Overlay" />
|
<div className="Overlay" />
|
||||||
</div>
|
</div>
|
||||||
<JobDropdown
|
<JobDropdown
|
||||||
currentJob={party.job.id}
|
currentJob={ (party.job) ? party.job.id : undefined}
|
||||||
onChange={receiveJob}
|
onChange={receiveJob}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue