Almost passed out

So last night out of nowhere I got really shaky and hot started sweating really bad felt like I was gonna puke so I got up to go to the bathroom and I was swaying and my vision was just overtaken by black spots I couldn't really see when I sat down my vision started coming back a bit but everything was still hazy and I was still shaking and having trouble breathing. I put my head between my knees and had my SO wet a rag for me to put on my head and started to feel a bit better but I have no idea what caused it and it really scared me.