leaf-document-web/src/store/config.ts

25 lines
875 B
TypeScript
Raw Normal View History

2023-12-04 13:33:37 +00:00
import {defineStore} from 'pinia'
// import axios from "axios";
export const useConfigStore = defineStore('app', {
state: () => ({
appName: "资料库",
description: "Leaf Library",
accountServer: "https://httpbin.awa.im",
}),
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()
}
},
})