Skip to content

Commit

Permalink
feat: Utilize signinPath Parameter (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkipperQ committed Aug 19, 2023
1 parent 2d9f4c5 commit ee5a8a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/CasdoorSDK.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ export default {
return CasdoorSDK.getMyProfileUrl(account);
};

app.config.globalProperties.signin = async (ServerUrl) => {
app.config.globalProperties.signin = async (ServerUrl, signinPath) => {
const code = window.location.href.split('code=')[1].split('&')[0];
const state = window.location.href.split('state=')[1].split('&')[0];
const res = await fetch(`${ServerUrl}/api/signin?code=${code}&state=${state}`, {
const path = signinPath || CasdoorSDK.config.signinPath || '/api/signin';
const res = await fetch(`${ServerUrl}${path}?code=${code}&state=${state}`, {
method: "POST",
credentials: "include"
})
Expand Down

0 comments on commit ee5a8a8

Please sign in to comment.