feat: 添加前端通行证API的返回类型
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { User } from "@/lib/types/user";
|
import { User } from "@/lib/types/user";
|
||||||
import { clientFetch } from "../client";
|
import { clientFetch } from "../client";
|
||||||
import { APIError } from "../common";
|
import { APIError } from "../common";
|
||||||
import { PublicKeyCredentialCreationOptionsJSON, RegistrationResponseJSON } from "@simplewebauthn/browser";
|
import { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from "@simplewebauthn/browser";
|
||||||
|
|
||||||
export async function loginByPassword(identifier: string, password: string) {
|
export async function loginByPassword(identifier: string, password: string) {
|
||||||
identifier = identifier.trim();
|
identifier = identifier.trim();
|
||||||
@@ -80,13 +80,13 @@ export async function passkeyRegister(name: string, credentialResponse: Registra
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getLoginByPasskeyOptions() {
|
export async function getLoginByPasskeyOptions() {
|
||||||
return clientFetch('/api/auth/passkey/login/options', {
|
return clientFetch<PublicKeyCredentialRequestOptionsJSON>('/api/auth/passkey/login/options', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loginByPasskey(credentialResponse: any) {
|
export async function loginByPasskey(credentialResponse: any) {
|
||||||
return clientFetch('/api/auth/passkey/login', {
|
return clientFetch<{ user: User }>('/api/auth/passkey/login', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
credentialResponse,
|
credentialResponse,
|
||||||
|
|||||||
Reference in New Issue
Block a user