Is there a way to store data locally in flash

I’ve recently finished this library, which might help. It offers more storage than the built-in EEPROM class.

It has a circular buffer, so you can push data in one end, and when the wifi connection comes back, pull it out from the other. The buffer manages the flash memory for you so you don’t have to worry about when to erase etc. And because it’s a circular buffer, all pages have equal wear, improving endurance of the flash.