@applica-software-guru/react-admin 1.0.62 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ra-pages/ActivatePage.d.ts +12 -0
- package/dist/components/ra-pages/ActivatePage.d.ts.map +1 -0
- package/dist/components/ra-pages/index.d.ts +2 -1
- package/dist/components/ra-pages/index.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +45 -45
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +4525 -4501
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +46 -46
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ra-pages/ActivatePage.tsx +58 -0
- package/src/components/ra-pages/index.ts +2 -1
- package/src/playground/App.jsx +2 -1
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { Grid, Stack, Typography } from '@mui/material';
|
|
3
|
+
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
4
|
+
import { useAuthProvider, useNotify, useTranslate } from 'ra-core';
|
|
5
|
+
|
|
6
|
+
import AuthWrapper from '../AuthWrapper';
|
|
7
|
+
import { BaseAuthProps } from './types';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
|
|
12
|
+
const ActivatePage = ({ name, version, background }: BaseAuthProps) => {
|
|
13
|
+
const translate = useTranslate();
|
|
14
|
+
const authProvider = useAuthProvider();
|
|
15
|
+
const notify = useNotify();
|
|
16
|
+
const navigate = useNavigate();
|
|
17
|
+
const { token } = useParams();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (typeof authProvider.activate !== 'function') {
|
|
20
|
+
throw new Error('The authProvider used for the ActivatePage must define an activate() method');
|
|
21
|
+
}
|
|
22
|
+
authProvider
|
|
23
|
+
.activate(token)
|
|
24
|
+
.then(() => {
|
|
25
|
+
notify('ra.auth.activate_success', { type: 'info' });
|
|
26
|
+
_.delay(() => navigate('/login'), 3000);
|
|
27
|
+
})
|
|
28
|
+
.catch((error: any) => {
|
|
29
|
+
notify(error, { type: 'error' });
|
|
30
|
+
_.delay(() => navigate('/login'), 3000);
|
|
31
|
+
});
|
|
32
|
+
}, [token]);
|
|
33
|
+
return (
|
|
34
|
+
<AuthWrapper name={name} version={version} background={background}>
|
|
35
|
+
<Grid container spacing={3}>
|
|
36
|
+
<Grid item xs={12}>
|
|
37
|
+
<Stack direction="row" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
|
|
38
|
+
<Typography variant="h3">{translate('ra.auth.activate')}</Typography>
|
|
39
|
+
<Typography component={Link} to={'/login'} variant="body1" sx={{ textDecoration: 'none' }} color="primary">
|
|
40
|
+
{translate('ra.auth.back_to_login')}
|
|
41
|
+
</Typography>
|
|
42
|
+
</Stack>
|
|
43
|
+
</Grid>
|
|
44
|
+
<Grid item xs={12}>
|
|
45
|
+
{translate('ra.auth.activate_pending')}
|
|
46
|
+
</Grid>
|
|
47
|
+
</Grid>
|
|
48
|
+
</AuthWrapper>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
ActivatePage.propTypes = {
|
|
53
|
+
name: PropTypes.string.isRequired,
|
|
54
|
+
version: PropTypes.string.isRequired,
|
|
55
|
+
background: PropTypes.node
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default ActivatePage;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import ActivatePage from './ActivatePage';
|
|
1
2
|
import LoginPage from './LoginPage';
|
|
2
3
|
import RecoverPage from './RecoverPage';
|
|
3
4
|
import RegisterPage from './RegisterPage';
|
|
4
|
-
export { LoginPage, RecoverPage, RegisterPage };
|
|
5
|
+
export { ActivatePage, LoginPage, RecoverPage, RegisterPage };
|
package/src/playground/App.jsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as entities from './entities';
|
|
4
4
|
|
|
5
5
|
import { API_URL, APP_NAME, FILE_FIELDS } from './config';
|
|
6
|
-
import { ApplicaAdmin, HttpError, RecoverPage, RegisterPage, Resource } from '@applica-software-guru/react-admin';
|
|
6
|
+
import { ActivatePage, ApplicaAdmin, HttpError, RecoverPage, RegisterPage, Resource } from '@applica-software-guru/react-admin';
|
|
7
7
|
import { createAttachmentsParser, createDataProvider } from '@applica-software-guru/crud-client';
|
|
8
8
|
|
|
9
9
|
import { CustomPage } from './components/pages';
|
|
@@ -52,6 +52,7 @@ const App = () => {
|
|
|
52
52
|
<CustomRoutes noLayout>
|
|
53
53
|
<Route path="/register" element={<RegisterPage name={APP_NAME} version={build.version} />} />
|
|
54
54
|
<Route path="/recover" element={<RecoverPage name={APP_NAME} version={build.version} />} />
|
|
55
|
+
<Route path="/activate/:token" element={<ActivatePage name={APP_NAME} version={build.version} />} />
|
|
55
56
|
</CustomRoutes>
|
|
56
57
|
</ApplicaAdmin>
|
|
57
58
|
);
|