It depends on how old the machine is and whether you want to make the repairs or call an expert.
I used this link to help me figure out what to do when I had the same problem.
Typically washers (and dryers) are fairly easy to disassemble, diagnose and repair. In addition to the link above, there are a ton of helpful step-by-step videos on Youtube - maybe even for your specific model.
Replace unless you're handy enough to do it yourself. It's ridiculous but they're practically disposable now.
$150 prob just to get someone to show up. Another $150 to fix it, if they can fix it. Another $50 using a laundrymat if they have to order a part that will take a week.
And all assuming it can be fixed, and that once fixed it stays fixed.
if you are at all handy it may be a very easy fix. If it leaks when it drains, it may be the hose from the tub to the pump, which absorbs a lot of vibration. I've replaced one on my front loader, but I admit that I do all of my own repairs.
Yesterday our washer suddenly leaked all the water from a load of laundry (after working fine for 2 or 3 prior loads). It is not a hose issue.
Repairable, or replacement?