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 New Issue
Block a user