Separate captcha into the backendInteractor
This commit is contained in:
parent
92de235f4e
commit
a525df32c9
@ -31,12 +31,7 @@ const registration = {
|
||||
this.$router.push('/main/all')
|
||||
}
|
||||
|
||||
fetch("/api/pleroma/captcha")
|
||||
.then(resp => resp.json())
|
||||
.then(resp => {
|
||||
// TODO: check for errors
|
||||
this.captcha = resp
|
||||
})
|
||||
this.getCaptcha().then(cpt => this.captcha = cpt)
|
||||
},
|
||||
computed: {
|
||||
token () { return this.$route.params.token },
|
||||
@ -49,7 +44,7 @@ const registration = {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['signUp']),
|
||||
...mapActions(['signUp', 'getCaptcha']),
|
||||
async submit () {
|
||||
this.user.nickname = this.user.username
|
||||
this.user.token = this.token
|
||||
|
@ -142,6 +142,10 @@ const users = {
|
||||
throw Error(errors)
|
||||
}
|
||||
},
|
||||
async getCaptcha (store) {
|
||||
return await store.rootState.api.backendInteractor.getCaptcha()
|
||||
},
|
||||
|
||||
logout (store) {
|
||||
store.commit('clearCurrentUser')
|
||||
store.commit('setToken', false)
|
||||
|
@ -167,6 +167,8 @@ const register = (params) => {
|
||||
})
|
||||
}
|
||||
|
||||
const getCaptcha = () => fetch('/api/pleroma/captcha').then(resp => resp.json())
|
||||
|
||||
const authHeaders = (accessToken) => {
|
||||
if (accessToken) {
|
||||
return { 'Authorization': `Bearer ${accessToken}` }
|
||||
@ -496,6 +498,7 @@ const apiService = {
|
||||
setUserMute,
|
||||
fetchMutes,
|
||||
register,
|
||||
getCaptcha,
|
||||
updateAvatar,
|
||||
updateBg,
|
||||
updateProfile,
|
||||
|
@ -71,6 +71,7 @@ const backendInteractorService = (credentials) => {
|
||||
const fetchMutes = () => apiService.fetchMutes({credentials})
|
||||
const fetchFollowRequests = () => apiService.fetchFollowRequests({credentials})
|
||||
|
||||
const getCaptcha = () => apiService.getCaptcha()
|
||||
const register = (params) => apiService.register(params)
|
||||
const updateAvatar = ({params}) => apiService.updateAvatar({credentials, params})
|
||||
const updateBg = ({params}) => apiService.updateBg({credentials, params})
|
||||
@ -100,6 +101,7 @@ const backendInteractorService = (credentials) => {
|
||||
setUserMute,
|
||||
fetchMutes,
|
||||
register,
|
||||
getCaptcha,
|
||||
updateAvatar,
|
||||
updateBg,
|
||||
updateBanner,
|
||||
|
Loading…
Reference in New Issue
Block a user