aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js10
-rw-r--r--src/services/backend_interactor_service/backend_interactor_service.js3
-rw-r--r--src/services/new_api/password_reset.js18
-rw-r--r--src/services/style_setter/style_setter.js8
4 files changed, 22 insertions, 17 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 4cf41e61..887d7d7a 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -4,7 +4,6 @@ import 'whatwg-fetch'
import { RegistrationError, StatusCodeError } from '../errors/errors'
/* eslint-env browser */
-const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import'
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
@@ -220,14 +219,6 @@ const authHeaders = (accessToken) => {
}
}
-const externalProfile = ({ profileUrl, credentials }) => {
- let url = `${EXTERNAL_PROFILE_URL}?profileurl=${profileUrl}`
- return fetch(url, {
- headers: authHeaders(credentials),
- method: 'GET'
- }).then((data) => data.json())
-}
-
const followUser = ({ id, credentials }) => {
let url = MASTODON_FOLLOW_URL(id)
return fetch(url, {
@@ -966,7 +957,6 @@ const apiService = {
updateBg,
updateProfile,
updateBanner,
- externalProfile,
importBlocks,
importFollows,
deleteAccount,
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
index 846d9415..3c44a10c 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -127,8 +127,6 @@ const backendInteractorService = credentials => {
const updateBanner = ({ banner }) => apiService.updateBanner({ credentials, banner })
const updateProfile = ({ params }) => apiService.updateProfile({ credentials, params })
- const externalProfile = (profileUrl) => apiService.externalProfile({ profileUrl, credentials })
-
const importBlocks = (file) => apiService.importBlocks({ file, credentials })
const importFollows = (file) => apiService.importFollows({ file, credentials })
@@ -194,7 +192,6 @@ const backendInteractorService = credentials => {
updateBg,
updateBanner,
updateProfile,
- externalProfile,
importBlocks,
importFollows,
deleteAccount,
diff --git a/src/services/new_api/password_reset.js b/src/services/new_api/password_reset.js
new file mode 100644
index 00000000..43199625
--- /dev/null
+++ b/src/services/new_api/password_reset.js
@@ -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
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
index f186d202..1cf7edc3 100644
--- a/src/services/style_setter/style_setter.js
+++ b/src/services/style_setter/style_setter.js
@@ -22,7 +22,7 @@ const setStyle = (href, commit) => {
***/
const head = document.head
const body = document.body
- body.style.display = 'none'
+ body.classList.add('hidden')
const cssEl = document.createElement('link')
cssEl.setAttribute('rel', 'stylesheet')
cssEl.setAttribute('href', href)
@@ -46,7 +46,7 @@ const setStyle = (href, commit) => {
head.appendChild(styleEl)
// const styleSheet = styleEl.sheet
- body.style.display = 'initial'
+ body.classList.remove('hidden')
}
cssEl.addEventListener('load', setDynamic)
@@ -75,7 +75,7 @@ const applyTheme = (input, commit) => {
const { rules, theme } = generatePreset(input)
const head = document.head
const body = document.body
- body.style.display = 'none'
+ body.classList.add('hidden')
const styleEl = document.createElement('style')
head.appendChild(styleEl)
@@ -86,7 +86,7 @@ const applyTheme = (input, commit) => {
styleSheet.insertRule(`body { ${rules.colors} }`, 'index-max')
styleSheet.insertRule(`body { ${rules.shadows} }`, 'index-max')
styleSheet.insertRule(`body { ${rules.fonts} }`, 'index-max')
- body.style.display = 'initial'
+ body.classList.remove('hidden')
// commit('setOption', { name: 'colors', value: htmlColors })
// commit('setOption', { name: 'radii', value: radii })