mirror of
https://gitlab.com/RemixDev/deemix-webui.git
synced 2024-12-28 18:36:30 +00:00
Changed POST calls to actual POST calls
This commit is contained in:
parent
aef5c775ba
commit
f399df1285
|
@ -66,9 +66,9 @@ async function startApp() {
|
|||
let result
|
||||
|
||||
if (accountNum !== 0) {
|
||||
result = await fetchData('login-arl', { arl, force: true, child: accountNum || 0 }, 'POST')
|
||||
result = await postToServer('loginArl', { arl, force: true, child: accountNum || 0 })
|
||||
} else {
|
||||
result = await fetchData('login-arl', { arl }, 'POST')
|
||||
result = await postToServer('loginArl', { arl })
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
|
@ -982,7 +982,7 @@ export default {
|
|||
},
|
||||
async login(arl, force = false) {
|
||||
toast(this.$t('toasts.loggingIn'), 'loading', false, 'login-toast')
|
||||
const data = await fetchData('login-arl', { arl, force, child: this.accountNum }, 'POST')
|
||||
const data = await postToServer('loginArl', { arl, force, child: this.accountNum })
|
||||
const { status, user, childs, currentChild } = data
|
||||
this.accounts = childs
|
||||
this.accountNum = currentChild
|
||||
|
@ -1024,7 +1024,7 @@ export default {
|
|||
|
||||
toast(this.$t('toasts.loggingIn'), 'loading', false, 'login-toast')
|
||||
|
||||
const { accessToken, arl } = await postToServer('loginWithCredentials', {
|
||||
const { accessToken, arl } = await postToServer('loginEmail', {
|
||||
email,
|
||||
password,
|
||||
accessToken: this.accessToken
|
||||
|
@ -1038,8 +1038,7 @@ export default {
|
|||
window.api.send('applogin')
|
||||
},
|
||||
async changeAccount() {
|
||||
// socket.emit('changeAccount', this.accountNum)
|
||||
const [user, accountNum] = await fetchData('changeAccount', { child: this.accountNum })
|
||||
const [user, accountNum] = await fetchData('changeAccount', { child: this.accountNum }, 'POST')
|
||||
|
||||
this.accountChanged(user, accountNum)
|
||||
},
|
||||
|
|
|
@ -25,7 +25,7 @@ export function sendToServer(key, data) {
|
|||
})
|
||||
}
|
||||
|
||||
export const postToServer = (endpoint, data) => {
|
||||
export function postToServer(endpoint, data) {
|
||||
const url = new URL(`${window.location.origin}/api/${endpoint}`)
|
||||
|
||||
return fetch(url, {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { fetchData } from '@/utils/api'
|
||||
import { postToServer } from '@/utils/api'
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
|
@ -7,7 +7,7 @@ import { fetchData } from '@/utils/api'
|
|||
export function sendAddToQueue(url, bitrate = null) {
|
||||
if (!url) throw new Error('No URL given to sendAddToQueue function!')
|
||||
|
||||
fetchData('addToQueue', { url, bitrate }, 'POST')
|
||||
postToServer('addToQueue', { url, bitrate })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue