mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Created admin API endpoints.
This commit is contained in:
parent
e1c65cdf2a
commit
442ad61779
8 changed files with 133 additions and 49 deletions
|
|
@ -11,7 +11,7 @@ export function UsersDataTable() {
|
|||
const modified = useCache((state: any) => state?.users);
|
||||
const queryResult = useFilterQuery({
|
||||
queryKey: ['users', { modified }],
|
||||
queryFn: (params: { [key: string]: any }) => get(`/users`, params),
|
||||
queryFn: (params: { [key: string]: any }) => get(`/admin/users`, params),
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export function WebsiteSettings({ websiteId, openExternal = false }) {
|
|||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { get, useQuery } = useApi();
|
||||
const { showToast } = useToasts();
|
||||
const { websitesUrl, settingsUrl } = useContext(SettingsContext);
|
||||
const { websitesUrl, websitesPath, settingsPath } = useContext(SettingsContext);
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ['website', websiteId],
|
||||
queryFn: () => get(`${websitesUrl}/${websiteId}`),
|
||||
|
|
@ -38,7 +38,7 @@ export function WebsiteSettings({ websiteId, openExternal = false }) {
|
|||
|
||||
const handleReset = async (value: string) => {
|
||||
if (value === 'delete') {
|
||||
router.push(settingsUrl);
|
||||
router.push(settingsPath);
|
||||
} else if (value === 'reset') {
|
||||
showSuccess();
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ export function WebsiteSettings({ websiteId, openExternal = false }) {
|
|||
return (
|
||||
<>
|
||||
<PageHeader title={values?.name}>
|
||||
<Link href={`${websitesUrl}/${websiteId}`} target={openExternal ? '_blank' : null}>
|
||||
<Link href={`${websitesPath}/${websiteId}`} target={openExternal ? '_blank' : null}>
|
||||
<Button variant="primary">
|
||||
<Icon>
|
||||
<Icons.External />
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export function WebsitesTable({
|
|||
const { formatMessage, labels } = useMessages();
|
||||
const { user } = useUser();
|
||||
const breakpoint = useBreakpoint();
|
||||
const { settingsUrl, websitesUrl } = useContext(SettingsContext);
|
||||
const { settingsPath, websitesPath } = useContext(SettingsContext);
|
||||
|
||||
return (
|
||||
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||
|
|
@ -52,7 +52,7 @@ export function WebsitesTable({
|
|||
return (
|
||||
<>
|
||||
{allowEdit && (!showTeam || ownerId === user.id) && (
|
||||
<Link href={`${settingsUrl}/${id}`}>
|
||||
<Link href={`${settingsPath}/${id}`}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.Edit />
|
||||
|
|
@ -62,7 +62,7 @@ export function WebsitesTable({
|
|||
</Link>
|
||||
)}
|
||||
{allowView && (
|
||||
<Link href={`${websitesUrl}/${id}`}>
|
||||
<Link href={`${websitesPath}/${id}`}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.External />
|
||||
|
|
|
|||
|
|
@ -33,10 +33,11 @@ function SettingsProvider({ children }) {
|
|||
const hostUrl = process.env.hostUrl || window?.location.origin;
|
||||
|
||||
setConfig({
|
||||
settingsUrl: '/settings/websites',
|
||||
shareUrl: hostUrl,
|
||||
trackingCodeUrl: hostUrl,
|
||||
websitesUrl: `/websites`,
|
||||
websitesUrl: '/websites',
|
||||
settingsPath: '/settings/websites',
|
||||
websitesPath: `/websites`,
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue