Create a provider option in the callback handler to define the provider name for flexibility when used with multiple providers and requiring multiple endpoints.
14 lines
327 B
TypeScript
14 lines
327 B
TypeScript
"use server";
|
|
import { api } from "@/shared/api/connector";
|
|
|
|
export const SendCallbackToServer = async (data: string, provider: string) => {
|
|
try {
|
|
const response = await api.get(`auth/${provider}/callback${data}`);
|
|
const result = await response.json();
|
|
|
|
return result;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
};
|