♻️ Tweaks in frontend (#1273)
This commit is contained in:
@@ -23,7 +23,7 @@ import {
|
||||
} from "../../client"
|
||||
import useAuth from "../../hooks/useAuth"
|
||||
import useCustomToast from "../../hooks/useCustomToast"
|
||||
import { emailPattern } from "../../utils"
|
||||
import { emailPattern, handleError } from "../../utils"
|
||||
|
||||
const UserInformation = () => {
|
||||
const queryClient = useQueryClient()
|
||||
@@ -57,13 +57,10 @@ const UserInformation = () => {
|
||||
showToast("Success!", "User updated successfully.", "success")
|
||||
},
|
||||
onError: (err: ApiError) => {
|
||||
const errDetail = (err.body as any)?.detail
|
||||
showToast("Something went wrong.", `${errDetail}`, "error")
|
||||
handleError(err, showToast)
|
||||
},
|
||||
onSettled: () => {
|
||||
// TODO: can we do just one call now?
|
||||
queryClient.invalidateQueries({ queryKey: ["users"] })
|
||||
queryClient.invalidateQueries({ queryKey: ["currentUser"] })
|
||||
queryClient.invalidateQueries()
|
||||
},
|
||||
})
|
||||
|
||||
@@ -104,6 +101,8 @@ const UserInformation = () => {
|
||||
size="md"
|
||||
py={2}
|
||||
color={!currentUser?.full_name ? "ui.dim" : "inherit"}
|
||||
isTruncated
|
||||
maxWidth="250px"
|
||||
>
|
||||
{currentUser?.full_name || "N/A"}
|
||||
</Text>
|
||||
@@ -125,7 +124,7 @@ const UserInformation = () => {
|
||||
w="auto"
|
||||
/>
|
||||
) : (
|
||||
<Text size="md" py={2}>
|
||||
<Text size="md" py={2} isTruncated maxWidth="250px">
|
||||
{currentUser?.email}
|
||||
</Text>
|
||||
)}
|
||||
|
Reference in New Issue
Block a user