hata düzeltme 2
This commit is contained in:
@@ -69,8 +69,8 @@ export async function deleteUser(userId: string) {
|
|||||||
// Check admin
|
// Check admin
|
||||||
try {
|
try {
|
||||||
await assertAdmin()
|
await assertAdmin()
|
||||||
} catch (error: any) {
|
} catch (error) {
|
||||||
return { error: error.message }
|
return { error: (error as Error).message }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete user
|
// Delete user
|
||||||
@@ -87,8 +87,8 @@ export async function updateUser(userId: string, data: { firstName: string, last
|
|||||||
// Check admin
|
// Check admin
|
||||||
try {
|
try {
|
||||||
await assertAdmin()
|
await assertAdmin()
|
||||||
} catch (error: any) {
|
} catch (error) {
|
||||||
return { error: error.message }
|
return { error: (error as Error).message }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Update Profile (Role and Name)
|
// 1. Update Profile (Role and Name)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default function SignUpPage() {
|
|||||||
if (data.user) {
|
if (data.user) {
|
||||||
setSuccess(true)
|
setSuccess(true)
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch {
|
||||||
setError("Bir hata oluştu. Lütfen tekrar deneyin.")
|
setError("Bir hata oluştu. Lütfen tekrar deneyin.")
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { useForm } from "react-hook-form"
|
import { useForm, type Resolver } from "react-hook-form"
|
||||||
import { zodResolver } from "@hookform/resolvers/zod"
|
import { zodResolver } from "@hookform/resolvers/zod"
|
||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
@@ -59,7 +59,7 @@ export function ProductForm({ initialData }: ProductFormProps) {
|
|||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const form = useForm<ProductFormValues>({
|
const form = useForm<ProductFormValues>({
|
||||||
resolver: zodResolver(productSchema) as any,
|
resolver: zodResolver(productSchema) as Resolver<ProductFormValues>,
|
||||||
defaultValues: initialData ? {
|
defaultValues: initialData ? {
|
||||||
name: initialData.name,
|
name: initialData.name,
|
||||||
category: initialData.category,
|
category: initialData.category,
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
||||||
import { SiteSettingsForm } from "@/components/dashboard/site-settings-form"
|
import { SiteSettingsForm, SettingsFormValues } from "@/components/dashboard/site-settings-form"
|
||||||
import { SmsSettingsForm } from "@/components/dashboard/sms-settings-form"
|
import { SmsSettingsForm } from "@/components/dashboard/sms-settings-form"
|
||||||
import { AppearanceForm } from "@/components/dashboard/appearance-form"
|
import { AppearanceForm } from "@/components/dashboard/appearance-form"
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
|
|
||||||
interface SettingsTabsProps {
|
interface SettingsTabsProps {
|
||||||
siteSettings: Record<string, any> | null
|
siteSettings: Partial<SettingsFormValues> | null
|
||||||
smsSettings: {
|
smsSettings: {
|
||||||
username: string
|
username: string
|
||||||
header: string
|
header: string
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ const settingsSchema = z.object({
|
|||||||
currency: z.string(),
|
currency: z.string(),
|
||||||
})
|
})
|
||||||
|
|
||||||
type SettingsFormValues = z.infer<typeof settingsSchema>
|
export type SettingsFormValues = z.infer<typeof settingsSchema>
|
||||||
|
|
||||||
interface SiteSettingsFormProps {
|
interface SiteSettingsFormProps {
|
||||||
initialData: any
|
initialData: Partial<SettingsFormValues> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SiteSettingsForm({ initialData }: SiteSettingsFormProps) {
|
export function SiteSettingsForm({ initialData }: SiteSettingsFormProps) {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import {
|
|||||||
FormLabel,
|
FormLabel,
|
||||||
FormMessage,
|
FormMessage,
|
||||||
} from "@/components/ui/form"
|
} from "@/components/ui/form"
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle, CardFooter } from "@/components/ui/card"
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { Loader2, Smartphone, Send } from "lucide-react"
|
import { Loader2, Send } from "lucide-react"
|
||||||
import { updateSmsSettings, sendTestSms } from "@/lib/sms/actions"
|
import { updateSmsSettings, sendTestSms } from "@/lib/sms/actions"
|
||||||
|
|
||||||
const smsSettingsSchema = z.object({
|
const smsSettingsSchema = z.object({
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface PhoneInputProps extends React.ComponentProps<typeof PhoneInput>
|
|||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const PhoneInputComponent = React.forwardRef<any, PhoneInputProps>(({ className, ...props }, ref) => {
|
const PhoneInputComponent = React.forwardRef<any, PhoneInputProps>(({ className, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<PhoneInput
|
<PhoneInput
|
||||||
@@ -14,6 +15,7 @@ const PhoneInputComponent = React.forwardRef<any, PhoneInputProps>(({ className,
|
|||||||
numberInputProps={{
|
numberInputProps={{
|
||||||
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
}}
|
}}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
{...(props as any)}
|
{...(props as any)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -58,7 +58,12 @@ export async function updateSmsSettings(data: {
|
|||||||
// Check if exists
|
// Check if exists
|
||||||
const { data: existing } = await supabaseAdmin.from('sms_settings').select('id').single()
|
const { data: existing } = await supabaseAdmin.from('sms_settings').select('id').single()
|
||||||
|
|
||||||
const updates: any = {
|
const updates: {
|
||||||
|
username: string
|
||||||
|
header: string
|
||||||
|
updated_at: string
|
||||||
|
password?: string
|
||||||
|
} = {
|
||||||
username: data.username,
|
username: data.username,
|
||||||
header: data.header,
|
header: data.header,
|
||||||
updated_at: new Date().toISOString()
|
updated_at: new Date().toISOString()
|
||||||
|
|||||||
Reference in New Issue
Block a user