polyphony-chat / polyphony

A multi-instance, Polyphony/Spacebar API-compatible chat client
Mozilla Public License 2.0
44 stars 2 forks source link

Remove code duplication in crate::auth::auth #13

Closed bitfl0wer closed 1 year ago

bitfl0wer commented 1 year ago

In crate::auth::auth, we have the register_fosscord and login_fosscord methods. They do almost the exact same thing, which is send a POST request with a json body to an API route, handling any errors that may occur on the way and return an outcome. This code could very easily be put into one method, which would make it re-usable and remove code duplicates :)