mirror of
https://gitlab.com/RemixDev/deemix-webui.git
synced 2024-12-29 10:56:05 +00:00
feat: added loginWithCredentials call
This commit is contained in:
parent
856fdbb6b7
commit
f659afffd2
File diff suppressed because one or more lines are too long
|
@ -802,7 +802,7 @@ import { copyToClipboard } from '@/utils/utils'
|
|||
|
||||
import BaseAccordion from '@/components/globals/BaseAccordion.vue'
|
||||
import TemplateVariablesList from '@components/settings/TemplateVariablesList.vue'
|
||||
import { fetchData } from '@/utils/api'
|
||||
import { fetchData, postToServer } from '@/utils/api'
|
||||
import { getFormItem } from '@/utils/forms'
|
||||
|
||||
export default {
|
||||
|
@ -993,9 +993,9 @@ export default {
|
|||
const { username } = fromLoginForm('username')
|
||||
const { password } = fromLoginForm('password')
|
||||
|
||||
// console.log({ username,password })
|
||||
postToServer('loginWithCredentials', { username, password })
|
||||
},
|
||||
appLogin(e) {
|
||||
appLogin() {
|
||||
socket.emit('applogin')
|
||||
},
|
||||
changeAccount() {
|
||||
|
|
|
@ -19,3 +19,15 @@ export function sendToServer(key, data) {
|
|||
|
||||
fetch(url.href).catch(console.error)
|
||||
}
|
||||
|
||||
export const postToServer = (endpoint, data) => {
|
||||
const url = new URL(`${window.location.origin}/api/${endpoint}`)
|
||||
|
||||
fetch(url, {
|
||||
body: JSON.stringify(data),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: 'POST'
|
||||
}).catch(console.error)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue