mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
support linking OAuth 2.0 user to logged-in users
This commit is contained in:
+9
-6
@@ -81,6 +81,10 @@ export const useRootStore = defineStore('root', () => {
|
||||
return services.generateOAuth2LoginUrl(platform, clientSessionId);
|
||||
}
|
||||
|
||||
function generateOAuth2LinkUrl(platform: 'mobile' | 'desktop', clientSessionId: string): string {
|
||||
return services.generateOAuth2LinkUrl(platform, clientSessionId);
|
||||
}
|
||||
|
||||
function authorize(req: UserLoginRequest): Promise<AuthResponse> {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.authorize(req).then(response => {
|
||||
@@ -191,14 +195,12 @@ export const useRootStore = defineStore('root', () => {
|
||||
});
|
||||
}
|
||||
|
||||
function authorizeOAuth2({ password, passcode, token }: { password?: string, passcode?: string, token: string }): Promise<AuthResponse> {
|
||||
function authorizeOAuth2({ password, passcode, callbackToken }: { password?: string, passcode?: string, callbackToken: string }): Promise<AuthResponse> {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.authorizeOAuth2({
|
||||
req: {
|
||||
password,
|
||||
passcode
|
||||
},
|
||||
token
|
||||
password,
|
||||
passcode,
|
||||
callbackToken
|
||||
}).then(response => {
|
||||
const data = response.data;
|
||||
|
||||
@@ -643,6 +645,7 @@ export const useRootStore = defineStore('root', () => {
|
||||
// functions
|
||||
setNotificationContent,
|
||||
generateOAuth2LoginUrl,
|
||||
generateOAuth2LinkUrl,
|
||||
authorize,
|
||||
authorize2FA,
|
||||
authorizeOAuth2,
|
||||
|
||||
Reference in New Issue
Block a user