updated nextjs example with app router

This commit is contained in:
dswbx
2025-02-27 20:09:03 +01:00
parent 2d5da63eb2
commit 09074f6591
36 changed files with 334 additions and 284 deletions

View File

@@ -1,4 +1,3 @@
import { Api, type ApiOptions } from "Api";
import type { CreateUserPayload } from "auth/AppAuth";
import { $console } from "core";
import { Event } from "core/events";
@@ -188,12 +187,10 @@ export class App {
return this.module.auth.createUser(p);
}
async getApi(options?: LocalApiOptions) {
getApi(options?: LocalApiOptions) {
const fetcher = this.server.request as typeof fetch;
if (options && options instanceof Request) {
const api = new Api({ request: options, headers: options.headers, fetcher });
await api.verifyAuth();
return api;
return new Api({ request: options, headers: options.headers, fetcher });
}
return new Api({ host: "http://localhost", ...(options ?? {}), fetcher });