Improved logout function.

Instead of using fetch function using request function.