Skip to content

Commit d6441b1

Browse files
authored
Merge branch 'master' into master
2 parents f4004b3 + df66c1d commit d6441b1

5 files changed

Lines changed: 42 additions & 18 deletions

File tree

frontend/src/client/services.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,19 @@ requestBody,
218218
});
219219
}
220220

221+
/**
222+
* Delete User Me
223+
* Delete own user.
224+
* @returns Message Successful Response
225+
* @throws ApiError
226+
*/
227+
public static deleteUserMe(): CancelablePromise<Message> {
228+
return __request(OpenAPI, {
229+
method: 'DELETE',
230+
url: '/api/v1/users/me',
231+
});
232+
}
233+
221234
/**
222235
* Update User Me
223236
* Update own user.

frontend/src/components/UserSettings/DeleteConfirmation.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"
1111
import React from "react"
1212
import { useForm } from "react-hook-form"
1313

14-
import { type ApiError, type UserPublic, UsersService } from "../../client"
14+
import { UsersService, type ApiError } from "../../client"
1515
import useAuth from "../../hooks/useAuth"
1616
import useCustomToast from "../../hooks/useCustomToast"
1717

@@ -28,11 +28,10 @@ const DeleteConfirmation = ({ isOpen, onClose }: DeleteProps) => {
2828
handleSubmit,
2929
formState: { isSubmitting },
3030
} = useForm()
31-
const currentUser = queryClient.getQueryData<UserPublic>(["currentUser"])
3231
const { logout } = useAuth()
3332

3433
const mutation = useMutation({
35-
mutationFn: (id: number) => UsersService.deleteUser({ userId: id }),
34+
mutationFn: () => UsersService.deleteUserMe(),
3635
onSuccess: () => {
3736
showToast(
3837
"Success",
@@ -52,7 +51,7 @@ const DeleteConfirmation = ({ isOpen, onClose }: DeleteProps) => {
5251
})
5352

5453
const onSubmit = async () => {
55-
mutation.mutate(currentUser!.id)
54+
mutation.mutate()
5655
}
5756

5857
return (

frontend/src/routes/__root.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,32 @@ import React, { Suspense } from "react"
33

44
import NotFound from "../components/Common/NotFound"
55

6-
const TanStackRouterDevtools =
6+
const loadDevtools = () =>
7+
Promise.all([
8+
import("@tanstack/router-devtools"),
9+
import("@tanstack/react-query-devtools")
10+
]).then(([routerDevtools, reactQueryDevtools]) => {
11+
return {
12+
default: () => (
13+
<>
14+
<routerDevtools.TanStackRouterDevtools />
15+
<reactQueryDevtools.ReactQueryDevtools />
16+
</>
17+
)
18+
};
19+
});
20+
21+
const TanStackDevtools =
722
process.env.NODE_ENV === "production"
823
? () => null
9-
: React.lazy(() =>
10-
import("@tanstack/router-devtools").then((res) => ({
11-
default: res.TanStackRouterDevtools,
12-
})),
13-
)
24+
: React.lazy(loadDevtools);
1425

1526
export const Route = createRootRoute({
1627
component: () => (
1728
<>
1829
<Outlet />
1930
<Suspense>
20-
<TanStackRouterDevtools />
31+
<TanStackDevtools />
2132
</Suspense>
2233
</>
2334
),

frontend/src/routes/_layout/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import { Box, Container, Text } from "@chakra-ui/react"
2-
import { useQueryClient } from "@tanstack/react-query"
32
import { createFileRoute } from "@tanstack/react-router"
43

5-
import type { UserPublic } from "../../client"
4+
import useAuth from "../../hooks/useAuth"
65

76
export const Route = createFileRoute("/_layout/")({
87
component: Dashboard,
98
})
109

1110
function Dashboard() {
12-
const queryClient = useQueryClient()
13-
14-
const currentUser = queryClient.getQueryData<UserPublic>(["currentUser"])
11+
const { user: currentUser } = useAuth()
1512

1613
return (
1714
<>

release-notes.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22

33
## Latest Changes
44

5-
* 🔧 Ignore `src/routeTree.gen.ts` in biome. PR [#1175](https://github.com/tiangolo/full-stack-fastapi-template/pull/1175) by [@patrick91](https://github.com/patrick91).
6-
75
### Features
86

7+
* ✨ Add TanStack React Query devtools in dev build. PR [#1217](https://github.com/tiangolo/full-stack-fastapi-template/pull/1217) by [@tomerb](https://github.com/tomerb).
98
* ✨ Add support for deploying multiple environments (staging, production) to the same server. PR [#1128](https://github.com/tiangolo/full-stack-fastapi-template/pull/1128) by [@tiangolo](https://github.com/tiangolo).
109
* 👷 Update CI GitHub Actions to allow running in private repos. PR [#1125](https://github.com/tiangolo/full-stack-fastapi-template/pull/1125) by [@tiangolo](https://github.com/tiangolo).
1110

1211
### Fixes
1312

13+
* 🐛 Fix welcome page to show logged-in user. PR [#1218](https://github.com/tiangolo/full-stack-fastapi-template/pull/1218) by [@tomerb](https://github.com/tomerb).
1414
* 🐛 Fix local Traefik proxy network config to fix Gateway Timeouts. PR [#1184](https://github.com/tiangolo/full-stack-fastapi-template/pull/1184) by [@JoelGotsch](https://github.com/JoelGotsch).
1515
* ♻️ Fix tests when first superuser password is changed in .env. PR [#1165](https://github.com/tiangolo/full-stack-fastapi-template/pull/1165) by [@billzhong](https://github.com/billzhong).
1616
* 🐛 Fix bug when resetting password. PR [#1171](https://github.com/tiangolo/full-stack-fastapi-template/pull/1171) by [@alejsdev](https://github.com/alejsdev).
1717
* 🐛 Fix 403 when the frontend has a directory without an index.html. PR [#1094](https://github.com/tiangolo/full-stack-fastapi-template/pull/1094) by [@tiangolo](https://github.com/tiangolo).
1818

1919
### Refactors
2020

21+
* ♻️ Update DeleteConfirmation component to use new service. PR [#1224](https://github.com/tiangolo/full-stack-fastapi-template/pull/1224) by [@alejsdev](https://github.com/alejsdev).
22+
* ♻️ Update client services. PR [#1223](https://github.com/tiangolo/full-stack-fastapi-template/pull/1223) by [@alejsdev](https://github.com/alejsdev).
2123
* ⚒️ Add minor frontend tweaks. PR [#1210](https://github.com/tiangolo/full-stack-fastapi-template/pull/1210) by [@alejsdev](https://github.com/alejsdev).
2224
* 🚚 Move assets to public folder. PR [#1206](https://github.com/tiangolo/full-stack-fastapi-template/pull/1206) by [@alejsdev](https://github.com/alejsdev).
2325
* ♻️ Refactor redirect labels to simplify removing the frontend. PR [#1208](https://github.com/tiangolo/full-stack-fastapi-template/pull/1208) by [@tiangolo](https://github.com/tiangolo).
@@ -65,6 +67,7 @@
6567

6668
### Docs
6769

70+
* 📝 Update release-notes.md. PR [#1220](https://github.com/tiangolo/full-stack-fastapi-template/pull/1220) by [@alejsdev](https://github.com/alejsdev).
6871
* ✏️ Update `README.md`. PR [#1205](https://github.com/tiangolo/full-stack-fastapi-template/pull/1205) by [@Craz1k0ek](https://github.com/Craz1k0ek).
6972
* ✏️ Fix Adminer URL in `deployment.md`. PR [#1194](https://github.com/tiangolo/full-stack-fastapi-template/pull/1194) by [@PhilippWu](https://github.com/PhilippWu).
7073
* 📝 Add `Enabling Open User Registration` to backend docs. PR [#1191](https://github.com/tiangolo/full-stack-fastapi-template/pull/1191) by [@alejsdev](https://github.com/alejsdev).
@@ -80,6 +83,7 @@
8083

8184
### Internal
8285

86+
* 🔧 Ignore `src/routeTree.gen.ts` in biome. PR [#1175](https://github.com/tiangolo/full-stack-fastapi-template/pull/1175) by [@patrick91](https://github.com/patrick91).
8387
* 👷 Update Smokeshow download artifact GitHub Action. PR [#1198](https://github.com/tiangolo/full-stack-fastapi-template/pull/1198) by [@tiangolo](https://github.com/tiangolo).
8488
* 🔧 Update Node.js version in `.nvmrc`. PR [#1192](https://github.com/tiangolo/full-stack-fastapi-template/pull/1192) by [@alejsdev](https://github.com/alejsdev).
8589
* 🔥 Remove ESLint and Prettier from pre-commit config. PR [#1096](https://github.com/tiangolo/full-stack-fastapi-template/pull/1096) by [@alejsdev](https://github.com/alejsdev).

0 commit comments

Comments
 (0)