logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

password_reset.js (456B)


  1. import { reduce } from 'lodash'
  2. const MASTODON_PASSWORD_RESET_URL = '/auth/password'
  3. const resetPassword = ({ instance, email }) => {
  4. const params = { email }
  5. const query = reduce(params, (acc, v, k) => {
  6. const encoded = `${k}=${encodeURIComponent(v)}`
  7. return `${acc}&${encoded}`
  8. }, '')
  9. const url = `${instance}${MASTODON_PASSWORD_RESET_URL}?${query}`
  10. return window.fetch(url, {
  11. method: 'POST'
  12. })
  13. }
  14. export default resetPassword