mirror of
https://gitlab.com/RemixDev/deemix-gui.git
synced 2024-12-29 11:06:13 +00:00
Added logic to loginWithCredentials
This commit is contained in:
parent
49f4804767
commit
47559071d6
|
@ -15,6 +15,9 @@ export const configFolder: string = deemix.utils.localpaths.getConfigFolder()
|
|||
export let settings: any = deemix.settings.load(configFolder)
|
||||
export const sessionDZ: any = {}
|
||||
|
||||
export const getAccessToken = deemix.utils.deezer.getAccessToken
|
||||
export const getArlFromAccessToken = deemix.utils.deezer.getArlFromAccessToken
|
||||
|
||||
const deemixPlugins = {}
|
||||
|
||||
export const listener = {
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
import { ApiHandler } from '../../../types'
|
||||
import { getAccessToken, getArlFromAccessToken } from '../../../main'
|
||||
|
||||
const path = '/loginWithCredentials'
|
||||
|
||||
const handler: ApiHandler['handler'] = (req, res) => {
|
||||
const { username, password } = req.body
|
||||
let accessToken = req.body.accessToken
|
||||
|
||||
if (!accessToken){
|
||||
const accessToken = getAccessToken(username, password)
|
||||
console.log({ accessToken })
|
||||
}
|
||||
const arl = getArlFromAccessToken(accessToken)
|
||||
|
||||
console.log({ username, password })
|
||||
res.send({ loggedIn: true })
|
||||
res.send({ accessToken, arl })
|
||||
}
|
||||
|
||||
const apiHandler = { path, handler }
|
||||
|
|
Loading…
Reference in a new issue