Skip to content

Commit e7e9bc3

Browse files
authored
Merge pull request #972 from joshunrau/dev
2 parents 7b3084c + bb5bba9 commit e7e9bc3

34 files changed

Lines changed: 647 additions & 202 deletions

apps/outreach/astro.config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ export default defineConfig({
9393
autogenerate: { directory: 'docs/5-reference' },
9494
label: 'Reference'
9595
},
96-
{
97-
autogenerate: { directory: 'docs/6-changelogs' },
98-
label: 'Changelogs'
99-
},
10096
starlightTypeDocSidebarGroup
10197
],
10298
social: {

apps/outreach/src/src/env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/src/Routes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { RouteObject } from 'react-router-dom';
55

66
import { Layout } from './components/Layout';
77
import { aboutRoute } from './features/about';
8+
import { adminRoute } from './features/admin';
89
import { authRoutes } from './features/auth';
910
import { contactRoute } from './features/contact';
1011
import { dashboardRoute } from './features/dashboard';
@@ -36,6 +37,7 @@ const protectedRoutes: RouteObject[] = [
3637
</DisclaimerProvider>
3738
),
3839
children: [
40+
adminRoute,
3941
aboutRoute,
4042
contactRoute,
4143
datahubRoute,

apps/web/src/components/Navbar/Navbar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export const Navbar = () => {
9797
</div>
9898
</Sheet.Footer>
9999
</Sheet.Content>
100-
<Sheet.Overlay />
101100
</Sheet>
102101
);
103102
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
2+
import type { CreateGroupData } from '@opendatacapture/schemas/group';
3+
import { useMutation, useQueryClient } from '@tanstack/react-query';
4+
import axios from 'axios';
5+
6+
export function useCreateGroupMutation() {
7+
const queryClient = useQueryClient();
8+
const addNotification = useNotificationsStore((store) => store.addNotification);
9+
return useMutation({
10+
mutationFn: ({ data }: { data: CreateGroupData }) => axios.post('/v1/groups', data),
11+
onSuccess() {
12+
addNotification({ type: 'success' });
13+
void queryClient.invalidateQueries({ queryKey: ['groups'] });
14+
}
15+
});
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
2+
import type { CreateUserData } from '@opendatacapture/schemas/user';
3+
import { useMutation, useQueryClient } from '@tanstack/react-query';
4+
import axios from 'axios';
5+
6+
export function useCreateUserMutation() {
7+
const queryClient = useQueryClient();
8+
const addNotification = useNotificationsStore((store) => store.addNotification);
9+
return useMutation({
10+
mutationFn: ({ data }: { data: CreateUserData }) => axios.post('/v1/users', data),
11+
onSuccess() {
12+
addNotification({ type: 'success' });
13+
void queryClient.invalidateQueries({ queryKey: ['users'] });
14+
}
15+
});
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
2+
import { useMutation, useQueryClient } from '@tanstack/react-query';
3+
import axios from 'axios';
4+
5+
export function useDeleteGroupMutation() {
6+
const queryClient = useQueryClient();
7+
const addNotification = useNotificationsStore((store) => store.addNotification);
8+
return useMutation({
9+
mutationFn: ({ id }: { id: string }) => axios.delete(`/v1/groups/${id}`),
10+
onSuccess() {
11+
addNotification({ type: 'success' });
12+
void queryClient.invalidateQueries({ queryKey: ['groups'] });
13+
}
14+
});
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
2+
import { useMutation, useQueryClient } from '@tanstack/react-query';
3+
import axios from 'axios';
4+
5+
export function useDeleteUserMutation() {
6+
const queryClient = useQueryClient();
7+
const addNotification = useNotificationsStore((store) => store.addNotification);
8+
return useMutation({
9+
mutationFn: ({ id }: { id: string }) => axios.delete(`/v1/users/${id}`),
10+
onSuccess() {
11+
addNotification({ type: 'success' });
12+
void queryClient.invalidateQueries({ queryKey: ['users'] });
13+
}
14+
});
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { $Group } from '@opendatacapture/schemas/group';
2+
import { useSuspenseQuery } from '@tanstack/react-query';
3+
import axios from 'axios';
4+
5+
export function useGroupsQuery() {
6+
return useSuspenseQuery({
7+
queryFn: async () => {
8+
const response = await axios.get('/v1/groups');
9+
return $Group.array().parse(response.data);
10+
},
11+
queryKey: ['groups']
12+
});
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { $User } from '@opendatacapture/schemas/user';
2+
import { useSuspenseQuery } from '@tanstack/react-query';
3+
import axios from 'axios';
4+
5+
export function useUsersQuery() {
6+
return useSuspenseQuery({
7+
queryFn: async () => {
8+
const response = await axios.get('/v1/users');
9+
return $User.array().parse(response.data);
10+
},
11+
queryKey: ['users']
12+
});
13+
}

0 commit comments

Comments
 (0)