The effect of episodic accretion on the phase transition of CO and CO_2 in low-mass star formation