useSWRMutation Error: No overload matches this call. Overload 1 of 3

I just learned TS, and after a while of coding, got this issue:

No overload matches this call.

Overload 1 of 3, ‘(extraArgument?: null | undefined, options?: SWRMutationConfiguration<ProcessLoginResponse, Payload, Key, never, ProcessLoginResponse> | undefined): Promise<…>’, gave the following error. Argument of type ‘{ email: string; password: string; }’ is not assignable to parameter of type ‘null | undefined’.

Overload 2 of 3, ‘(extraArgument?: null | undefined, options?: (SWRMutationConfiguration<ProcessLoginResponse, Payload, Key, never, ProcessLoginResponse> & { …; }) | undefined): Promise<…>’, gave the following error. Argument of type ‘{ email: string; password: string; }’ is not assignable to parameter of type ‘null | undefined’.

Overload 3 of 3, ‘(extraArgument?: null | undefined, options?: (SWRMutationConfiguration<ProcessLoginResponse, Payload, Key, never, ProcessLoginResponse> & { …; }) | undefined): Promise<…>’, gave the following error. Argument of type ‘{ email: string; password: string; }’ is not assignable to parameter of type ‘null | undefined’.

Here is the code

useLogin.tsx

import useSWRMutation from 'swr/mutation'

import { httpClient } from '@/Libraries/httpClient'

type Payload = {
  email: string
  password: string
}

type ProcessLoginResponse = {
  result: 'OK'
  login_token?: string
  error_code?: number
  description?: string
}

const path = '/mobile_api/viewer/account/login'

const attemptLogin = async (path: string, { arg }: { arg: Payload }) => {
  const response = await httpClient.post<ProcessLoginResponse>(path, arg)
  return response.data
}

export const useLogin = () => {
  const { trigger, data, error, isMutating } = useSWRMutation<
    ProcessLoginResponse,
    Payload
  >(path, attemptLogin)

  return {
    triggerLogin: trigger,
    data,
    error,
    isMutating,
  }
}

Form.tsx

import React, { ChangeEvent, FC } from 'react'

import { Link, useForm } from '@inertiajs/react'

import { useLogin } from '../Hooks/useLogin'

import { Button } from '@/Features/Viewer/Login/Components/Button'
import InputField from '@/Features/Viewer/Login/Components/InputField'

const Form: FC = () => {
  const { triggerLogin, isMutating } = useLogin()
  const { data: formData, setData } = useForm({
    email: '',
    password: '',
  })

  const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
    const { name, value } = e.target
    setData({ ...formData, [name]: value })
  }

  const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
    e.preventDefault()
    triggerLogin(formData)
  }

  return (
    <form onSubmit={handleSubmit} className="flex flex-col">
      <div className="flex flex-col mb-2">
        <InputField
          id="email"
          name="email"
          type="text"
          value={formData.email}
          onChange={handleChange}
          placeholder="パスワード"
          label="半角英数字を入力してください"
        />
        <InputField
          id="password"
          name="password"
          type="password"
          value={formData.password}
          onChange={handleChange}
          placeholder="パスワード"
          label="4〜12文字の半角英数字を入力してください"
        />
      </div>
      <Button bgColor="bg-[#76cccd]" disabled={isMutating}>
        ログイン
      </Button>
      <Link className="mt-4 mb-8 text-center text-[#42BFC0] font-bold" href="/">
        パスワードをお忘れの場合
      </Link>
    </form>
  )
}

export default Form

I tried solution from Copilot and ChatGPT but then the issue will move to other function used.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật