remove ofetch, replace with fetch

This commit is contained in:
Jorrin
2024-04-19 20:41:21 +02:00
parent eea4eab60b
commit 75f5256b20
15 changed files with 132 additions and 111 deletions

View File

@@ -1,21 +1,20 @@
import { ofetch } from "ofetch";
import type {
ChallengeTokenResponse,
LoginInput,
LoginResponse,
} from "./types";
import { f } from "./fetch";
export async function getLoginChallengeToken(
url: string,
publicKey: string,
): Promise<ChallengeTokenResponse> {
return ofetch<ChallengeTokenResponse>("/auth/login/start", {
return f<ChallengeTokenResponse>("/auth/login/start", {
method: "POST",
body: {
publicKey,
},
baseURL: url,
baseUrl: url,
});
}
@@ -23,12 +22,12 @@ export async function loginAccount(
url: string,
data: LoginInput,
): Promise<LoginResponse> {
return ofetch<LoginResponse>("/auth/login/complete", {
return f<LoginResponse>("/auth/login/complete", {
method: "POST",
body: {
namespace: "movie-web",
...data,
},
baseURL: url,
baseUrl: url,
});
}