import {POST} from "@/shared/api/apiClient";
import {useAuthStore} from "@/shared/store/authStore";
import {OAUTH, OAUTH_VERIFY} from "@/shared/constants";

export const sendPhoneNumber = async (phone: string) => {
  await POST(OAUTH, { phone });
};

export const verifyCode = async (phone: string, verify_code: number): Promise<any> => {
  const response = await POST(OAUTH_VERIFY, { phone, verify_code });
  const {data} = response?.data;
  useAuthStore.getState().login(data);
  return data;
};
