It depends.
If you have a contract, Instantaneously getting fired usually happens only if the employer did something which has negative recursion for the employer or during probation. (at least in my country.)
Otherwhise you have the right for notice the same way as when you quit and give your notice to the empleyer.
(Well, most employer tries to play around this with “mutual agreement” but technically that doesn’t count as getting fired, and it is usually a way for employers to play less, than simply firing their employers.)