27 lines
986 B
TypeScript
27 lines
986 B
TypeScript
import {defineStore} from 'pinia'
|
|
// import axios from "axios";
|
|
|
|
export const useConfigStore = defineStore('app', {
|
|
state: () => ({
|
|
appName: "资料库",
|
|
description: "Leaf Library",
|
|
accountServer: "https://oauth.leaflow.cn",
|
|
apiServer: "https://document-api.leaflow.cn/api",
|
|
// apiServer: "http://localhost:8080/api",
|
|
}),
|
|
actions: {
|
|
getAppName(): string {
|
|
return this.appName !== null ? this.appName : "Leaf Library"
|
|
},
|
|
getRefreshUrl(): string {
|
|
return this.accountServer + "/public/auth_request/refresh"
|
|
},
|
|
getLoginUrl(): string {
|
|
let url = new URL(this.accountServer + "/public/auth_request")
|
|
url.searchParams.append("description", this.description)
|
|
// url.searchParams.append("callback_uri", window.location.href)
|
|
url.searchParams.append("attributes[app]", "todo")
|
|
return url.toString()
|
|
}
|
|
},
|
|
}) |