Thrush

My baby has thrush. I want to try to breastfeed again. I gave up after only a few days. Should I just pump until he finishes his medicine? (Which is another full week). I don't want to risk getting Nipple thrush and he gets the bacteria again.