mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Patching a bug when delete an organization, add refetch.
This commit is contained in:
+3
@@ -14,6 +14,8 @@ export type DeleteOrganizationButtonProps = {
|
||||
|
||||
export const DeleteOrganizationButton = (props: DeleteOrganizationButtonProps) => {
|
||||
const router = useRouter();
|
||||
const {data: organizations, refetch} = authClient.useListOrganizations();
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: () => deleteOrganizationAction(props.organizationSlug),
|
||||
|
||||
@@ -25,6 +27,7 @@ export const DeleteOrganizationButton = (props: DeleteOrganizationButtonProps) =
|
||||
router.push("/");
|
||||
toast.success(result.data.actionSuccess?.message || "Organization deleted.");
|
||||
router.refresh()
|
||||
refetch()
|
||||
} else {
|
||||
// @ts-ignore
|
||||
const errorMsg = result?.data?.actionError?.message || result?.data?.actionError?.messageParams?.message || "Failed to delete the organization.";
|
||||
|
||||
@@ -4,7 +4,6 @@ import {ComboBox} from "@/components/wrappers/common/combobox";
|
||||
import {useSidebar} from "@/components/ui/sidebar";
|
||||
import {useRouter} from "next/navigation";
|
||||
import {authClient} from "@/lib/auth/auth-client";
|
||||
import {auth} from "@/lib/auth/auth";
|
||||
|
||||
|
||||
export function OrganizationCombobox() {
|
||||
@@ -16,9 +15,6 @@ export function OrganizationCombobox() {
|
||||
|
||||
if (!organizations) return null;
|
||||
|
||||
console.log("organizations", organizations);
|
||||
console.log("activeOrganization", activeOrganization);
|
||||
|
||||
const values = organizations.map((organization) => {
|
||||
return {
|
||||
value: organization.slug,
|
||||
@@ -26,8 +22,6 @@ export function OrganizationCombobox() {
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
const onValueChange = async (slug: string) => {
|
||||
|
||||
await authClient.organization.setActive({
|
||||
|
||||
Reference in New Issue
Block a user