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
|
let result
|
||||||
|
|
||||||
if (accountNum !== 0) {
|
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 {
|
} else {
|
||||||
result = await fetchData('login-arl', { arl }, 'POST')
|
result = await postToServer('loginArl', { arl })
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -982,7 +982,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async login(arl, force = false) {
|
async login(arl, force = false) {
|
||||||
toast(this.$t('toasts.loggingIn'), 'loading', false, 'login-toast')
|
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
|
const { status, user, childs, currentChild } = data
|
||||||
this.accounts = childs
|
this.accounts = childs
|
||||||
this.accountNum = currentChild
|
this.accountNum = currentChild
|
||||||
@ -1024,7 +1024,7 @@ export default {
|
|||||||
|
|
||||||
toast(this.$t('toasts.loggingIn'), 'loading', false, 'login-toast')
|
toast(this.$t('toasts.loggingIn'), 'loading', false, 'login-toast')
|
||||||
|
|
||||||
const { accessToken, arl } = await postToServer('loginWithCredentials', {
|
const { accessToken, arl } = await postToServer('loginEmail', {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
accessToken: this.accessToken
|
accessToken: this.accessToken
|
||||||
@ -1038,8 +1038,7 @@ export default {
|
|||||||
window.api.send('applogin')
|
window.api.send('applogin')
|
||||||
},
|
},
|
||||||
async changeAccount() {
|
async changeAccount() {
|
||||||
// socket.emit('changeAccount', this.accountNum)
|
const [user, accountNum] = await fetchData('changeAccount', { child: this.accountNum }, 'POST')
|
||||||
const [user, accountNum] = await fetchData('changeAccount', { child: this.accountNum })
|
|
||||||
|
|
||||||
this.accountChanged(user, accountNum)
|
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}`)
|
const url = new URL(`${window.location.origin}/api/${endpoint}`)
|
||||||
|
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { fetchData } from '@/utils/api'
|
import { postToServer } from '@/utils/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
@ -7,7 +7,7 @@ import { fetchData } from '@/utils/api'
|
|||||||
export function sendAddToQueue(url, bitrate = null) {
|
export function sendAddToQueue(url, bitrate = null) {
|
||||||
if (!url) throw new Error('No URL given to sendAddToQueue function!')
|
if (!url) throw new Error('No URL given to sendAddToQueue function!')
|
||||||
|
|
||||||
fetchData('addToQueue', { url, bitrate }, 'POST')
|
postToServer('addToQueue', { url, bitrate })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user