leaf-document-web/src/store/config.ts
2023-12-12 22:02:40 +08:00

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()
}
},
})