A heat-switch-based electrocaloric cooler