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 let settings: any = deemix.settings.load(configFolder)
|
||||||
export const sessionDZ: any = {}
|
export const sessionDZ: any = {}
|
||||||
|
|
||||||
|
export const getAccessToken = deemix.utils.deezer.getAccessToken
|
||||||
|
export const getArlFromAccessToken = deemix.utils.deezer.getArlFromAccessToken
|
||||||
|
|
||||||
const deemixPlugins = {}
|
const deemixPlugins = {}
|
||||||
|
|
||||||
export const listener = {
|
export const listener = {
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
import { ApiHandler } from '../../../types'
|
import { ApiHandler } from '../../../types'
|
||||||
|
import { getAccessToken, getArlFromAccessToken } from '../../../main'
|
||||||
|
|
||||||
const path = '/loginWithCredentials'
|
const path = '/loginWithCredentials'
|
||||||
|
|
||||||
const handler: ApiHandler['handler'] = (req, res) => {
|
const handler: ApiHandler['handler'] = (req, res) => {
|
||||||
const { username, password } = req.body
|
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 })
|
console.log({ username, password })
|
||||||
res.send({ loggedIn: true })
|
res.send({ accessToken, arl })
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiHandler = { path, handler }
|
const apiHandler = { path, handler }
|
||||||
|
Loading…
Reference in New Issue
Block a user