Password reset page

This commit is contained in:
Eugenij 2019-09-05 11:23:28 +00:00 committed by Shpuld Shpludson
parent c89703a359
commit 8ee5abb1a5
8 changed files with 226 additions and 0 deletions

View file

@ -0,0 +1,18 @@
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