pleroma-fe/src/services/new_api/password_reset.js
Henry Jameson fddb531ed2 --fix
2022-07-31 12:35:48 +03:00

18 lines
456 B
JavaScript

import { reduce } from 'lodash'
const MASTODON_PASSWORD_RESET_URL = '/auth/password'
const resetPassword = ({ instance, email }) => {
const params = { email }
const query = reduce(params, (acc, v, k) => {
const encoded = `${k}=${encodeURIComponent(v)}`
return `${acc}&${encoded}`
}, '')
const url = `${instance}${MASTODON_PASSWORD_RESET_URL}?${query}`
return window.fetch(url, {
method: 'POST'
})
}
export default resetPassword