diff --git a/package-lock.json b/package-lock.json
index 1f0ab8a..e441e1d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"@mui/x-data-grid-premium": "^8.10.0",
"@mui/x-date-pickers": "^8.10.0",
"@rkheftan/harmony-ui": "^0.1.8",
+ "@rollup/rollup-win32-x64-msvc": "^4.46.3",
"axios": "^1.11.0",
"date-fns": "^4.1.0",
"date-fns-jalali": "^4.0.0-0",
@@ -1863,6 +1864,34 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.44.1.tgz",
+ "integrity": "sha512-JAcBr1+fgqx20m7Fwe1DxPUl/hPkee6jA6Pl7n1v2EFiktAHenTaXl5aIFjUIEsfn9w3HE4gK1lEgNGMzBDs1w==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.44.1.tgz",
+ "integrity": "sha512-RurZetXqTu4p+G0ChbnkwBuAtwAbIwJkycw1n6GvlGlBuS4u5qlr5opix8cBAYFJgaY05TWtM+LaoFggUmbZEQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
"node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.44.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.44.1.tgz",
@@ -1877,6 +1906,242 @@
"darwin"
]
},
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.44.1.tgz",
+ "integrity": "sha512-gDnWk57urJrkrHQ2WVx9TSVTH7lSlU7E3AFqiko+bgjlh78aJ88/3nycMax52VIVjIm3ObXnDL2H00e/xzoipw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.44.1.tgz",
+ "integrity": "sha512-wnFQmJ/zPThM5zEGcnDcCJeYJgtSLjh1d//WuHzhf6zT3Md1BvvhJnWoy+HECKu2bMxaIcfWiu3bJgx6z4g2XA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.44.1.tgz",
+ "integrity": "sha512-uBmIxoJ4493YATvU2c0upGz87f99e3wop7TJgOA/bXMFd2SvKCI7xkxY/5k50bv7J6dw1SXT4MQBQSLn8Bb/Uw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.44.1.tgz",
+ "integrity": "sha512-n0edDmSHlXFhrlmTK7XBuwKlG5MbS7yleS1cQ9nn4kIeW+dJH+ExqNgQ0RrFRew8Y+0V/x6C5IjsHrJmiHtkxQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.44.1.tgz",
+ "integrity": "sha512-8WVUPy3FtAsKSpyk21kV52HCxB+me6YkbkFHATzC2Yd3yuqHwy2lbFL4alJOLXKljoRw08Zk8/xEj89cLQ/4Nw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.44.1.tgz",
+ "integrity": "sha512-yuktAOaeOgorWDeFJggjuCkMGeITfqvPgkIXhDqsfKX8J3jGyxdDZgBV/2kj/2DyPaLiX6bPdjJDTu9RB8lUPQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.44.1.tgz",
+ "integrity": "sha512-W+GBM4ifET1Plw8pdVaecwUgxmiH23CfAUj32u8knq0JPFyK4weRy6H7ooxYFD19YxBulL0Ktsflg5XS7+7u9g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loongarch64-gnu": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.44.1.tgz",
+ "integrity": "sha512-1zqnUEMWp9WrGVuVak6jWTl4fEtrVKfZY7CvcBmUUpxAJ7WcSowPSAWIKa/0o5mBL/Ij50SIf9tuirGx63Ovew==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.44.1.tgz",
+ "integrity": "sha512-Rl3JKaRu0LHIx7ExBAAnf0JcOQetQffaw34T8vLlg9b1IhzcBgaIdnvEbbsZq9uZp3uAH+JkHd20Nwn0h9zPjA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.44.1.tgz",
+ "integrity": "sha512-j5akelU3snyL6K3N/iX7otLBIl347fGwmd95U5gS/7z6T4ftK288jKq3A5lcFKcx7wwzb5rgNvAg3ZbV4BqUSw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.44.1.tgz",
+ "integrity": "sha512-ppn5llVGgrZw7yxbIm8TTvtj1EoPgYUAbfw0uDjIOzzoqlZlZrLJ/KuiE7uf5EpTpCTrNt1EdtzF0naMm0wGYg==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.44.1.tgz",
+ "integrity": "sha512-Hu6hEdix0oxtUma99jSP7xbvjkUM/ycke/AQQ4EC5g7jNRLLIwjcNwaUy95ZKBJJwg1ZowsclNnjYqzN4zwkAw==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.44.1.tgz",
+ "integrity": "sha512-EtnsrmZGomz9WxK1bR5079zee3+7a+AdFlghyd6VbAjgRJDbTANJ9dcPIPAi76uG05micpEL+gPGmAKYTschQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.44.1.tgz",
+ "integrity": "sha512-iAS4p+J1az6Usn0f8xhgL4PaU878KEtutP4hqw52I4IO6AGoyOkHCxcc4bqufv1tQLdDWFx8lR9YlwxKuv3/3g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.44.1.tgz",
+ "integrity": "sha512-NtSJVKcXwcqozOl+FwI41OH3OApDyLk3kqTJgx8+gp6On9ZEt5mYhIsKNPGuaZr3p9T6NWPKGU/03Vw4CNU9qg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.44.1.tgz",
+ "integrity": "sha512-JYA3qvCOLXSsnTR3oiyGws1Dm0YTuxAAeaYGVlGpUsHqloPcFjPg+X0Fj2qODGLNwQOAcCiQmHub/V007kiH5A==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.46.3",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.46.3.tgz",
+ "integrity": "sha512-fi3cPxCnu3ZeM3EwKZPgXbWoGzm2XHgB/WShKI81uj8wG0+laobmqy5wbgEwzstlbLu4MyO8C19FyhhWseYKNQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "os": [
+ "win32"
+ ]
+ },
"node_modules/@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@@ -5321,6 +5586,20 @@
"fsevents": "~2.3.2"
}
},
+ "node_modules/rollup/node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.1.tgz",
+ "integrity": "sha512-J8o22LuF0kTe7m+8PvW9wk3/bRq5+mRo5Dqo6+vXb7otCm3TPhYOJqOaQtGU9YMWQSL3krMnoOxMr0+9E6F3Ug==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
diff --git a/package.json b/package.json
index c803456..32132f3 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"@mui/x-data-grid-premium": "^8.10.0",
"@mui/x-date-pickers": "^8.10.0",
"@rkheftan/harmony-ui": "^0.1.8",
+ "@rollup/rollup-win32-x64-msvc": "^4.46.3",
"axios": "^1.11.0",
"date-fns": "^4.1.0",
"date-fns-jalali": "^4.0.0-0",
diff --git a/public/locales/en/authentication.json b/public/locales/en/authentication.json
index c1af38d..faead09 100644
--- a/public/locales/en/authentication.json
+++ b/public/locales/en/authentication.json
@@ -58,6 +58,7 @@
"accountSettings": "account settings",
"harmonyClub": "Harmony club",
"encourageYourBusinessCustomersToMakeRepeatPurchasesBySendingThemDiscountCodesAndPoints": "Encourage your business customers to make repeat purchases by sending them discount codes and points.",
- "redirectingTo": "Redirecting to"
+ "redirectingTo": "Redirecting to",
+ "redirecting": "Redirecting..."
}
}
diff --git a/public/locales/fa/authentication.json b/public/locales/fa/authentication.json
index 9df6cf9..00081ca 100644
--- a/public/locales/fa/authentication.json
+++ b/public/locales/fa/authentication.json
@@ -60,6 +60,7 @@
"accountSettings": "تنظیمات حساب",
"harmonyClub": "هارمونی کلاب",
"encourageYourBusinessCustomersToMakeRepeatPurchasesBySendingThemDiscountCodesAndPoints": "با ارسال کد تخفیف و امتیاز به مشتریان کسب و کارتان آنها را به خرید مجدد ترغیب کنید ",
- "redirectingTo": "در حال انتقال به"
+ "redirectingTo": "در حال انتقال به",
+ "redirecting": "درحال انتقال..."
}
}
diff --git a/src/features/authorization/components/AccountCreated/AccountCreated.tsx b/src/features/authorization/components/AccountCreated/AccountCreated.tsx
index 1bc795e..ba49095 100644
--- a/src/features/authorization/components/AccountCreated/AccountCreated.tsx
+++ b/src/features/authorization/components/AccountCreated/AccountCreated.tsx
@@ -6,8 +6,9 @@ import { useTranslation } from 'react-i18next';
import { Link as RouterLink, useSearchParams } from 'react-router-dom';
import Link from '@mui/material/Link';
import { AccountCreatedClubBanner } from './AccountCreatedClubBanner';
+import { AccountCreatedRedirectButton } from './AccountCreatedRedirectButton';
-type RequestedApplication = 'default' | 'unknown' | 'club';
+export type RequestedApplication = 'default' | 'unknown' | 'club';
export const AccountCreated = () => {
const { t } = useTranslation('authentication');
@@ -19,13 +20,21 @@ export const AccountCreated = () => {
if (!returnUrl) return 'default';
- if (returnUrl.includes('https://club.business-harmony.com/')) {
+ if (returnUrl.includes('club.business-harmony.com')) {
return 'club';
}
return 'unknown';
}, [params]);
+ const handleRedirectUser = () => {
+ const returnUrl = params.get('returnUrl');
+
+ if (returnUrl) {
+ location.href = returnUrl;
+ }
+ };
+
return (
@@ -50,7 +59,14 @@ export const AccountCreated = () => {
- {requestedApplication === 'club' && }
+
+ {requestedApplication === 'club' && }
+
+
+
)}
diff --git a/src/features/authorization/components/AccountCreated/AccountCreatedClubBanner.tsx b/src/features/authorization/components/AccountCreated/AccountCreatedClubBanner.tsx
index b1de1f0..213e17c 100644
--- a/src/features/authorization/components/AccountCreated/AccountCreatedClubBanner.tsx
+++ b/src/features/authorization/components/AccountCreated/AccountCreatedClubBanner.tsx
@@ -9,7 +9,7 @@ export const AccountCreatedClubBanner = () => {
const theme = useTheme();
return (
-
+
diff --git a/src/features/authorization/components/AccountCreated/AccountCreatedRedirectButton.tsx b/src/features/authorization/components/AccountCreated/AccountCreatedRedirectButton.tsx
index e69de29..1cd78cb 100644
--- a/src/features/authorization/components/AccountCreated/AccountCreatedRedirectButton.tsx
+++ b/src/features/authorization/components/AccountCreated/AccountCreatedRedirectButton.tsx
@@ -0,0 +1,51 @@
+import { useMemo } from 'react';
+import type { RequestedApplication } from './AccountCreated';
+import { Box, Button, useTheme } from '@mui/material';
+import { useTranslation } from 'react-i18next';
+import { CountDownTimer } from '@/components/CountDownTimer';
+import type { PalleteColor } from '@/theme/palette';
+
+export interface AccountCreatedRedirectButtonProps {
+ requestedApplication: RequestedApplication;
+ onRedirectUser: () => void;
+}
+
+export const AccountCreatedRedirectButton = ({
+ requestedApplication,
+ onRedirectUser,
+}: AccountCreatedRedirectButtonProps) => {
+ const { t } = useTranslation('authentication');
+
+ const buttonText = useMemo(() => {
+ switch (requestedApplication) {
+ case 'club':
+ return (
+ t('accountCreated.redirectingTo') +
+ ' ' +
+ t('accountCreated.harmonyClub')
+ );
+
+ default:
+ return t('accountCreated.redirecting');
+ }
+ }, [requestedApplication, t]);
+
+ const buttonColor = useMemo(() => {
+ switch (requestedApplication) {
+ case 'club':
+ return 'club';
+
+ default:
+ return 'primary';
+ }
+ }, [requestedApplication]);
+
+ return (
+
+
+
+ );
+};
diff --git a/src/features/authorization/components/AuthenticationSteps/AuthenticationSteps.tsx b/src/features/authorization/components/AuthenticationSteps/AuthenticationSteps.tsx
index ad240b8..344427b 100644
--- a/src/features/authorization/components/AuthenticationSteps/AuthenticationSteps.tsx
+++ b/src/features/authorization/components/AuthenticationSteps/AuthenticationSteps.tsx
@@ -49,27 +49,31 @@ export const AuthenticationSteps = (): JSX.Element => {
}
};
- const handleUserLoggedIn = (userId: GUID) => {
- localStorage.setItem('userID', userId);
-
+ const handleUserLoggedIn = () => {
redirectToReturnUrl();
};
- const handleConfrimPhoneNumber = (userId: GUID) => {
- localStorage.setItem('userID', userId);
-
+ const handleConfrimPhoneNumber = () => {
setCurrentStep('addPhoneNumber');
};
const handlePhoneNumberVerified = () => {
- navigate('/signup');
+ if (authReturnUrl) {
+ navigate(`/signup?returnUrl=${authReturnUrl}`);
+ } else {
+ navigate(`/signup`);
+ }
};
const redirectToReturnUrl = () => {
if (!authReturnUrl) {
navigate(import.meta.env.VITE_DEFUALT_AUTH_RETURN_URL);
} else {
- location.href = authReturnUrl;
+ if (authMode === 'register') {
+ navigate(`/account-created?returnUrl=${authReturnUrl}`);
+ } else {
+ location.href = authReturnUrl;
+ }
}
};
diff --git a/src/features/authorization/routes/UserCompletionPage.tsx b/src/features/authorization/routes/UserCompletionPage.tsx
index 6286474..20ae7b0 100644
--- a/src/features/authorization/routes/UserCompletionPage.tsx
+++ b/src/features/authorization/routes/UserCompletionPage.tsx
@@ -21,10 +21,13 @@ import { least8Chars } from '@/utils/regexes/least8Chars';
import { containsNumber } from '@/utils/regexes/containsNumber';
import { hasUpperAndLowerLetter } from '@/utils/regexes/hasUpperAndLowerLetter';
import { isEmail } from '@/utils/regexes/isEmail';
+import { useNavigate, useSearchParams } from 'react-router-dom';
export function UserCompletionPage() {
+ const [params] = useSearchParams();
const { t } = useTranslation('completionForm');
const showToast = useToast();
+ const navigate = useNavigate();
const [firstName, setFirstName] = useState('');
const [lastName, setLastName] = useState('');
@@ -128,13 +131,23 @@ export function UserCompletionPage() {
),
severity: submitData.data.success ? 'success' : 'error',
});
+
+ if (submitData.data.success) {
+ const returnUrl = params.get('returnUrl');
+
+ navigate(
+ returnUrl
+ ? `/account-created?returnUrl=${returnUrl}`
+ : '`/account-created',
+ );
+ }
} else if (submitError) {
showToast({
message: getErrorMessage(submitError) || t('completion.problem'),
severity: 'error',
});
}
- }, [submitData, submitError, showToast, t]);
+ }, [submitData, submitError, showToast, t, navigate, params]);
useEffect(() => {
setShowPasswordValidations(password ? !validPassword : false);
diff --git a/src/providers/AuthProvider.tsx b/src/providers/AuthProvider.tsx
index 5111903..7add190 100644
--- a/src/providers/AuthProvider.tsx
+++ b/src/providers/AuthProvider.tsx
@@ -114,31 +114,43 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
}
try {
- const result = await axios.post(
- import.meta.env.VITE_IDENTITY_URL,
- new URLSearchParams({
- grant_type: 'refresh_token',
- refresh_token: refreshToken,
- client_id: import.meta.env.VITE_IDENTITY_CLIENT_ID, // from your token payload
- }),
- {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
+ const activeRefreshSession: string | null =
+ sessionStorage.getItem('active-refresh');
+
+ if (
+ !activeRefreshSession ||
+ (activeRefreshSession && JSON.parse(activeRefreshSession) === false)
+ ) {
+ sessionStorage.setItem('active-refresh', JSON.stringify(true));
+
+ const result = await axios.post(
+ import.meta.env.VITE_IDENTITY_URL,
+ new URLSearchParams({
+ grant_type: 'refresh_token',
+ refresh_token: refreshToken,
+ client_id: import.meta.env.VITE_IDENTITY_CLIENT_ID, // from your token payload
+ }),
+ {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ },
},
- },
- );
+ );
- if (result.data.access_token) {
- inMemoryToken = result.data.access_token;
- expiresAt = Date.now() + result.data.expires_in * 1000;
+ if (result.data.access_token) {
+ inMemoryToken = result.data.access_token;
+ expiresAt = Date.now() + result.data.expires_in * 1000;
- sessionStorage.setItem(ACCESS_TOKEN_KEY, inMemoryToken as string);
- sessionStorage.setItem(REFRESH_TOKEN_KEY, result.data.refresh_token);
- sessionStorage.setItem(EXPIRES_IN_KEY, String(expiresAt));
+ sessionStorage.setItem(ACCESS_TOKEN_KEY, inMemoryToken as string);
+ sessionStorage.setItem(REFRESH_TOKEN_KEY, result.data.refresh_token);
+ sessionStorage.setItem(EXPIRES_IN_KEY, String(expiresAt));
- setAccessToken(inMemoryToken);
- } else {
- logout();
+ setAccessToken(inMemoryToken);
+ } else {
+ logout();
+ }
+
+ sessionStorage.setItem('active-refresh', JSON.stringify(false));
}
} catch {
logout();
diff --git a/src/routes/config.tsx b/src/routes/config.tsx
index 9d12741..760815d 100644
--- a/src/routes/config.tsx
+++ b/src/routes/config.tsx
@@ -76,6 +76,7 @@ export const appRoutes: RouteConfig[] = [
{
path: '/account-created',
element: ,
+ authorize: true,
},
{ path: '/signup', element: , authorize: true },
{
diff --git a/src/theme/palette.ts b/src/theme/palette.ts
index e3c1dc8..a71a7de 100644
--- a/src/theme/palette.ts
+++ b/src/theme/palette.ts
@@ -10,6 +10,21 @@ declare module '@mui/material/styles' {
}
}
+declare module '@mui/material/Button' {
+ interface ButtonPropsColorOverrides {
+ club: true;
+ }
+}
+
+export type PalleteColor =
+ | 'primary'
+ | 'secondary'
+ | 'error'
+ | 'success'
+ | 'warning'
+ | 'info'
+ | 'club';
+
export const lightPalette: PaletteOptions = {
mode: 'light',
primary: PALETTE.primary.light,