casdoor-js-sdk
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -7,2 +7,3 @@ export interface SdkConfig { | ||
redirectPath?: string; | ||
signinPath?: string; | ||
} | ||
@@ -33,4 +34,4 @@ export interface Account { | ||
getMyProfileUrl(account: Account, returnUrl?: String): string; | ||
signin(serverUrl: string): Promise<Response>; | ||
signin(serverUrl: string, signinPath?: string): Promise<Response>; | ||
} | ||
export default Sdk; |
@@ -72,3 +72,3 @@ "use strict"; | ||
} | ||
signin(serverUrl) { | ||
signin(serverUrl, signinPath) { | ||
const params = new URLSearchParams(window.location.search); | ||
@@ -90,3 +90,3 @@ const code = params.get("code"); | ||
} | ||
return fetch(`${serverUrl}/api/signin?code=${code}&state=${state}`, { | ||
return fetch(`${serverUrl}${signinPath || this.config.signinPath || '/api/signin'}?code=${code}&state=${state}`, { | ||
method: "POST", | ||
@@ -93,0 +93,0 @@ credentials: "include", |
@@ -7,2 +7,3 @@ export interface SdkConfig { | ||
redirectPath?: string; | ||
signinPath?: string; | ||
} | ||
@@ -33,4 +34,4 @@ export interface Account { | ||
getMyProfileUrl(account: Account, returnUrl?: String): string; | ||
signin(serverUrl: string): Promise<Response>; | ||
signin(serverUrl: string, signinPath?: string): Promise<Response>; | ||
} | ||
export default Sdk; |
@@ -70,3 +70,3 @@ // Copyright 2021 The casbin Authors. All Rights Reserved. | ||
} | ||
signin(serverUrl) { | ||
signin(serverUrl, signinPath) { | ||
const params = new URLSearchParams(window.location.search); | ||
@@ -88,3 +88,3 @@ const code = params.get("code"); | ||
} | ||
return fetch(`${serverUrl}/api/signin?code=${code}&state=${state}`, { | ||
return fetch(`${serverUrl}${signinPath || this.config.signinPath || '/api/signin'}?code=${code}&state=${state}`, { | ||
method: "POST", | ||
@@ -91,0 +91,0 @@ credentials: "include", |
{ | ||
"name": "casdoor-js-sdk", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "Javascript client SDK for Casdoor", | ||
@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js", |
@@ -47,2 +47,3 @@ # casdoor-js-sdk | ||
| redirectPath | No | the path of the redirect URL for your Casdoor application, will be `/callback` if not provided | | ||
| signinPath | No | the path of the signin URL for your Casdoor application, will be `/api/signin` if not provided | | ||
@@ -58,2 +59,3 @@ ```typescript | ||
redirectPath: "/callback", | ||
signinPath: "/api/signin", | ||
} | ||
@@ -81,2 +83,3 @@ const sdk = new SDK(sdkConfig) | ||
redirectPath: "/callback", | ||
signinPath: "/api/signin", | ||
} | ||
@@ -132,3 +135,3 @@ window.sdk = new SDK(sdkConfig) | ||
```typescript | ||
signin(serverUrl) | ||
signin(serverUrl, signinPath) | ||
``` | ||
@@ -135,0 +138,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29037
294
148