Sorry to hear about that..
You require a thorough and complete ocular examination..
It could be because of a simple refractive error
or even a migraine
should be ruled out..
If everything comes normal, you can take treatment for migraine which may give some relief from the pains..
Consult an ophthalmologist get the eye examination done..