Hello Ferny_21,
Thanks for posting in the Apple Support Communities.
If you're seeing that the charging case only works while it's connected to power, check the charge status light on the front of the case without the AirPods in the case. Depending on the status light, you may need to reset your AirPods or check into service options. Check out the following information for more details, and let us know what you find: Charge your AirPods and learn about battery life - Apple Support
If your AirPods are in your case and the lid is open, then the light shows the charge status of your AirPods. When your AirPods aren't in your case, the light shows the status of your case. Green means fully charged, and amber means less than one full charge remains.
When you connect your MagSafe Charging Case or Wireless Charging Case to a charger, or place it on a Qi-certified charging mat, the status light will stay on for 8 seconds. If the light flashes white, your AirPods are ready to set up with one of your devices. If the light flashes amber, you might need to set up your AirPods again.
If that doesn't help, let us know what happens when you try to use your AirPods or pair with a different device.
Take care!