akkoma-fe/src/services/new_api/password_reset.js
2019-09-05 11:23:28 +00: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