Fix: Correct signUp type definition

The signUp function in AuthContextType was expecting only two arguments (email, password) but the RegisterForm component was passing three arguments (email, password, username). This commit updates the AuthContextType definition to match the actual usage in the RegisterForm component, resolving the TypeScript error.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 15:18:01 +00:00
parent 3c96a9deac
commit 0f07edaa98
3 changed files with 17 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import { parseResponse, showAuthToast } from '@/utils/auth';
/**
* 직접 API 호출을 통한 회원가입
*/
export const signUpWithDirectApi = async (email: string, password: string) => {
export const signUpWithDirectApi = async (email: string, password: string, username: string) => {
try {
console.log('직접 API 호출로 회원가입 시도 중');
@@ -31,7 +31,11 @@ export const signUpWithDirectApi = async (email: string, password: string) => {
const response = await fetch(signUpUrl, {
method: 'POST',
headers,
body: JSON.stringify({ email, password })
body: JSON.stringify({
email,
password,
data: { username } // 사용자 메타데이터에 username 추가
})
});
console.log('회원가입 응답 상태:', response.status);
@@ -64,7 +68,7 @@ export const signUpWithDirectApi = async (email: string, password: string) => {
const user = {
id: responseData.id,
email: responseData.email,
user_metadata: responseData.user_metadata || {},
user_metadata: responseData.user_metadata || { username },
app_metadata: responseData.app_metadata || {},
created_at: responseData.created_at,
};