Finish authentication flow for 2FA
This commit is contained in:
parent
7f3ab8aadf
commit
212773d63c
9 changed files with 232 additions and 162 deletions
18
resources/scripts/api/auth/loginCheckpoint.ts
Normal file
18
resources/scripts/api/auth/loginCheckpoint.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import http from '@/api/http';
|
||||
import { LoginResponse } from '@/api/auth/login';
|
||||
|
||||
export default (token: string, code: string): Promise<LoginResponse> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post('/auth/login/checkpoint', {
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
confirmation_token: token,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
authentication_code: code,
|
||||
})
|
||||
.then(response => resolve({
|
||||
complete: response.data.data.complete,
|
||||
intended: response.data.data.intended || undefined,
|
||||
}))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
Reference in a new issue