Optical sensors for operando stress monitoring in lithium-based batteries containing solid-state or liquid electrolytes