mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
refactor(ui): social sign-in api update (#763)
social sign-in api update
This commit is contained in:
parent
d78c115db1
commit
da3de542d2
3 changed files with 7 additions and 5 deletions
|
@ -193,12 +193,11 @@ describe('api', () => {
|
|||
it('signInWithSocial', async () => {
|
||||
const parameters = {
|
||||
connectorId: 'connectorId',
|
||||
state: 'state',
|
||||
redirectUri: 'redirectUri',
|
||||
code: 'code',
|
||||
};
|
||||
await signInWithSocial(parameters);
|
||||
expect(ky.post).toBeCalledWith('/api/session/sign-in/social', {
|
||||
expect(ky.post).toBeCalledWith('/api/session/sign-in/social/auth', {
|
||||
json: parameters,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,7 +22,6 @@ export const invokeSocialSignIn = async (
|
|||
|
||||
export const signInWithSocial = async (parameters: {
|
||||
connectorId: string;
|
||||
state: string;
|
||||
redirectUri: string;
|
||||
code: string;
|
||||
}) => {
|
||||
|
@ -31,7 +30,7 @@ export const signInWithSocial = async (parameters: {
|
|||
};
|
||||
|
||||
return api
|
||||
.post('/api/session/sign-in/social', {
|
||||
.post('/api/session/sign-in/social/auth', {
|
||||
json: parameters,
|
||||
})
|
||||
.json<Response>();
|
||||
|
|
|
@ -132,7 +132,11 @@ const useSocial = (options?: Options) => {
|
|||
|
||||
return;
|
||||
}
|
||||
void asyncSignInWithSocial({ connectorId, state, code, redirectUri: '' });
|
||||
void asyncSignInWithSocial({
|
||||
connectorId,
|
||||
code,
|
||||
redirectUri: `${origin}/callback/${connectorId}`,
|
||||
});
|
||||
},
|
||||
[asyncSignInWithSocial, setToast, t]
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue