New Iphone 8 doesn’t work

Just bought a Iphone 8 today from the apple store. Took it home and turned it on, like it should the apple logo came on, but then the phone shut off. Without even touching the phone, the phone would turn on and off every few seconds. After watching this for an hour, I put it in recovery mode and plugged it in to my PC. While trying to restore it, I only got error codes.
Anybody here ever had this problem? I’m planning to just take it back and ask for a new one.
View Reddit by SpeeOutlaw – View Source