2019-03-02 10:25:10 +00:00
|
|
|
import AbstractService from './abstractService'
|
|
|
|
import PasswordResetModel from '../models/passwordReset'
|
|
|
|
|
|
|
|
export default class PasswordResetService extends AbstractService {
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super({})
|
|
|
|
this.paths = {
|
|
|
|
reset: '/user/password/reset',
|
|
|
|
requestReset: '/user/password/token',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
modelFactory(data) {
|
|
|
|
return new PasswordResetModel(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
resetPassword(model) {
|
|
|
|
const cancel = this.setLoading()
|
|
|
|
return this.http.post(this.paths.reset, model)
|
|
|
|
.then(response => {
|
2021-10-09 16:34:57 +02:00
|
|
|
return this.modelFactory(response.data)
|
2019-03-02 10:25:10 +00:00
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
cancel()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
requestResetPassword(model) {
|
|
|
|
const cancel = this.setLoading()
|
|
|
|
return this.http.post(this.paths.requestReset, model)
|
|
|
|
.then(response => {
|
2021-10-09 16:34:57 +02:00
|
|
|
return this.modelFactory(response.data)
|
2019-03-02 10:25:10 +00:00
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
cancel()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|