You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oaer/lib/api/index.ts

36 lines
730 B
TypeScript

/*
* Copyright (C) 2019 light <veypi@light-laptop>
*
* Distributed under terms of the MIT license.
*/
import user from './user'
import app from './app'
import cfg from '../cfg'
import ajax from './axios'
import nats from './nats'
import tsdb from './tsdb'
const api = {
nats: nats,
tsdb: tsdb,
user: user,
app: app,
info: () => {
return ajax.get(cfg.BaseUrl() + '/info')
},
refresh_token: () => {
ajax.post(cfg.BaseUrl() + '/app/' + cfg.uuid + '/token/', { app_id: cfg.uuid, token: cfg.refresh }).then(e => {
cfg.token = e
// bus.emit('sync', e)
}).catch(e => {
console.warn(e)
// bus.emit('logout', 'get token failed ' + e)
})
}
}
export { api }
export default api