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/oaf/src/api/app.ts

50 lines
1.4 KiB
TypeScript

/*
* @name: app
* @author: veypi <i@veypi.com>
* @date: 2021-11-17 14:44
* @descriptionap
* @update: 2021-11-17 14:44
*/
import {Interface} from './interface'
import ajax from './ajax'
import {BaseUrl} from './setting'
export default {
local: BaseUrl + 'app/',
self() {
return new Interface(ajax.get, this.local, {option: 'oa'})
},
getKey(uuid: string) {
return new Interface(ajax.get, this.local + uuid, {option: 'key'})
},
create(name: string, icon: string) {
return new Interface(ajax.post, this.local, {name, icon})
},
get(uuid: string) {
return new Interface(ajax.get, this.local + uuid)
},
list() {
return new Interface(ajax.get, this.local)
},
update(uuid: string, props: any) {
return new Interface(ajax.patch, this.local + uuid, props)
},
user(uuid: string) {
if (uuid === '') {
uuid = '-'
}
return {
local: this.local + uuid + '/user/',
list(uid: number) {
return new Interface(ajax.get, this.local + uid)
},
add(uid: number) {
return new Interface(ajax.post, this.local + uid)
},
update(uid: number, status: string) {
return new Interface(ajax.patch, this.local + uid, {status})
},
}
},
}