But don't wait too long. Being out of work for an extended period of time makes it psychologically difficult to find work again, and extended periods of not working makes most employers wary of hiring you. So the longer you're out of work, the harder it'll be for you to find work.
Even if your next job is not perfect, at least it'll put food on the table while you're there, and finding another job won't be as hard as it would be after a long period of not working.
Also, consider psychedelic therapy. It can give you a new perspective on your own life and the world, and there's a lot of research showing it can be very effective at treating major depression.