hata düzeltme 2
This commit is contained in:
@@ -69,8 +69,8 @@ export async function deleteUser(userId: string) {
|
||||
// Check admin
|
||||
try {
|
||||
await assertAdmin()
|
||||
} catch (error: any) {
|
||||
return { error: error.message }
|
||||
} catch (error) {
|
||||
return { error: (error as Error).message }
|
||||
}
|
||||
|
||||
// Delete user
|
||||
@@ -87,8 +87,8 @@ export async function updateUser(userId: string, data: { firstName: string, last
|
||||
// Check admin
|
||||
try {
|
||||
await assertAdmin()
|
||||
} catch (error: any) {
|
||||
return { error: error.message }
|
||||
} catch (error) {
|
||||
return { error: (error as Error).message }
|
||||
}
|
||||
|
||||
// 1. Update Profile (Role and Name)
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function SignUpPage() {
|
||||
if (data.user) {
|
||||
setSuccess(true)
|
||||
}
|
||||
} catch (err: any) {
|
||||
} catch {
|
||||
setError("Bir hata oluştu. Lütfen tekrar deneyin.")
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
|
||||
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 * as z from "zod"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -59,7 +59,7 @@ export function ProductForm({ initialData }: ProductFormProps) {
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
const form = useForm<ProductFormValues>({
|
||||
resolver: zodResolver(productSchema) as any,
|
||||
resolver: zodResolver(productSchema) as Resolver<ProductFormValues>,
|
||||
defaultValues: initialData ? {
|
||||
name: initialData.name,
|
||||
category: initialData.category,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use client"
|
||||
|
||||
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 { AppearanceForm } from "@/components/dashboard/appearance-form"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
interface SettingsTabsProps {
|
||||
siteSettings: Record<string, any> | null
|
||||
siteSettings: Partial<SettingsFormValues> | null
|
||||
smsSettings: {
|
||||
username: string
|
||||
header: string
|
||||
|
||||
@@ -30,10 +30,10 @@ const settingsSchema = z.object({
|
||||
currency: z.string(),
|
||||
})
|
||||
|
||||
type SettingsFormValues = z.infer<typeof settingsSchema>
|
||||
export type SettingsFormValues = z.infer<typeof settingsSchema>
|
||||
|
||||
interface SiteSettingsFormProps {
|
||||
initialData: any
|
||||
initialData: Partial<SettingsFormValues> | null
|
||||
}
|
||||
|
||||
export function SiteSettingsForm({ initialData }: SiteSettingsFormProps) {
|
||||
|
||||
@@ -15,9 +15,9 @@ import {
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} 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 { Loader2, Smartphone, Send } from "lucide-react"
|
||||
import { Loader2, Send } from "lucide-react"
|
||||
import { updateSmsSettings, sendTestSms } from "@/lib/sms/actions"
|
||||
|
||||
const smsSettingsSchema = z.object({
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface PhoneInputProps extends React.ComponentProps<typeof PhoneInput>
|
||||
className?: string
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const PhoneInputComponent = React.forwardRef<any, PhoneInputProps>(({ className, ...props }, ref) => {
|
||||
return (
|
||||
<PhoneInput
|
||||
@@ -14,6 +15,7 @@ const PhoneInputComponent = React.forwardRef<any, PhoneInputProps>(({ className,
|
||||
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",
|
||||
}}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
{...(props as any)}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -58,7 +58,12 @@ export async function updateSmsSettings(data: {
|
||||
// Check if exists
|
||||
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,
|
||||
header: data.header,
|
||||
updated_at: new Date().toISOString()
|
||||
|
||||
Reference in New Issue
Block a user