🏗️ (arch) change model folder to lib

change model to lib becase the model folder that will use for zod validation
This commit is contained in:
2025-10-07 21:49:05 +07:00
parent 8b82f4744e
commit 54f4e72b32
5 changed files with 3 additions and 3 deletions

View File

@ -1,13 +0,0 @@
"use server";
import { api } from "@/shared/lib/ky/connector";
const getOauthProviderList = async () => {
try {
const res = await api.get(`auth/providers`);
return res.json();
} catch (error) {
throw new Error("Failed to fetch OAuth providers", { cause: error });
}
};
export default getOauthProviderList;

View File

@ -1,36 +0,0 @@
"use server";
import { api } from "@/shared/lib/ky/connector";
import { redirect } from "next/navigation";
import { ResponseRequestOauthUrl } from "../types/responseRequestOauthUrl";
const requestOauthUrl = async (providerData: {
name: string;
endpoint: string;
}) => {
// Check if requestEndpoint is provided, if not throw an error
if (!providerData.endpoint)
throw new Error("oAuth endpoint request not found");
// Define a variable to hold the OAuth data
let oauthData: Promise<ResponseRequestOauthUrl>;
// Fetch OAuth data from the API
try {
const response = await api.get(providerData.endpoint, {
searchParams: {
callback: `${
process.env.APP_DOMAIN
}/auth/callback/${providerData.name.toLocaleLowerCase()}`,
},
});
oauthData = response.json<ResponseRequestOauthUrl>();
} catch (error) {
throw new Error(JSON.stringify(error));
}
// Redirect to the OAuth provider's authorization page
redirect((await oauthData).data);
};
export default requestOauthUrl;

View File

@ -1,27 +0,0 @@
"use server";
import { apiErrorHandler } from "@/shared/lib/ky/errorHandler";
import { RegisterInputs } from "../ui/components/ProvisionInput";
import { ServerRequestCallback } from "@/shared/types/ServerRequestCallback";
export const submitRegisterForm = async (
data: RegisterInputs
): Promise<ServerRequestCallback> => {
if (data.password !== data.confirmPassword)
return apiErrorHandler([], {
success: false,
status: 400,
text: { message: "Password and Confirm Password do not match" },
});
try {
await new Promise((resolve) => setTimeout(resolve, 3000));
return {
success: true,
status: 200,
text: { message: "Registration successful" },
};
} catch (error) {
return apiErrorHandler(error);
}
};