mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-24 18:48:55 +08:00
30 lines
569 B
JavaScript
30 lines
569 B
JavaScript
import API from '../api';
|
|
import { UPGRADE_LINK } from '../constants';
|
|
|
|
export const useAuth = () => {
|
|
const { subscriptionId } = 123;
|
|
|
|
const redirectToConnect = async () => {
|
|
const link = await getConnectLink();
|
|
|
|
window.open(link, '_self').focus();
|
|
};
|
|
|
|
const getConnectLink = async () => {
|
|
return API.initConnect();
|
|
};
|
|
|
|
const getUpgradeLink = () => {
|
|
const url = new URL(UPGRADE_LINK);
|
|
|
|
url.searchParams.append('subscription_id', subscriptionId);
|
|
|
|
return url.toString();
|
|
};
|
|
|
|
return {
|
|
redirectToConnect,
|
|
getConnectLink,
|
|
getUpgradeLink,
|
|
};
|
|
};
|