one-click-accessibility/assets/dev/js/hooks/use-auth.js
VasylD 8573e61f5b
[APP-1513] add disconnected msg (#290)
* [APP-1513] add disconnected msg

* [APP-1513] add disconnected msg

* [APP-1513] add disconnected msg
2025-06-09 11:24:42 +02:00

30 lines
599 B
JavaScript

import API from '@ea11y-apps/global/api';
import { GOLINKS } from '@ea11y-apps/global/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(GOLINKS.UPGRADE);
url.searchParams.append('subscription_id', subscriptionId);
return url.toString();
};
return {
redirectToConnect,
getConnectLink,
getUpgradeLink,
};
};