Switch won't boot

Yesterday night I got an error code but didn’t think much of it. I tried to restart my Switch but as soon as I did that it kept booting up until a “Nintendo” logo appeared. When it appeared it would stay at the Nintendo logo for about two seconds until eventually shutting down. I charged it first, and when I put it into my friends dock it was showing signs of the battery being charged. So I drained it over night and then charged it again.

However today I am having even bigger issues with this. 1. The Switch hardly boots and if it does it boots to the same Nintendo screen, it is having issues even getting to the logo. 2. If I put it back into a dock it no longer shows me the battery in the top left. So I have no real idea of what is going on with my Switch at the moment.

Is there a fix to this?