fix(auth): move initialAuthState/AuthState to auth-types.ts

Server-action files ('use server') can only export async functions.
Exporting initialAuthState (object) caused:
  'A use server file can only export async functions, found object'
when sign-up form was submitted.

Moved AuthState type and initialAuthState const to lib/appwrite/auth-types.ts.
Updated 3 form components to import the const from the new location.
This commit is contained in:
kovakmedya
2026-04-30 03:08:26 +03:00
parent dfa1b28632
commit d8b61b7da8
5 changed files with 13 additions and 12 deletions
+1 -9
View File
@@ -5,13 +5,7 @@ import { redirect } from "next/navigation";
import { AppwriteException, ID } from "node-appwrite";
import { APPWRITE_SESSION_COOKIE, createAdminClient, createSessionClient } from "./server";
export type AuthState = {
ok: boolean;
error?: string;
};
const initial: AuthState = { ok: false };
import type { AuthState } from "./auth-types";
function appwriteError(e: unknown): string {
if (e instanceof AppwriteException) {
@@ -114,5 +108,3 @@ export async function signOutAction() {
(await cookies()).delete(APPWRITE_SESSION_COOKIE);
redirect("/sign-in");
}
export const initialAuthState = initial;