+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
}
diff --git a/src/app/(marketing)/profile/_hooks/useContribution.tsx b/src/app/(marketing)/profile/_hooks/useContribution.tsx
index add0bb92f6..88c4c01317 100644
--- a/src/app/(marketing)/profile/_hooks/useContribution.tsx
+++ b/src/app/(marketing)/profile/_hooks/useContribution.tsx
@@ -4,7 +4,7 @@ import { useProfile } from "./useProfile"
export const useContribution = () => {
const { data: profileData } = useProfile()
- return useSWRImmutable
(
+ return useSWRImmutable(
profileData ? `/v2/profiles/${profileData.username}/contributions` : null
)
}
diff --git a/src/app/(marketing)/profile/_hooks/useCreateContribution.tsx b/src/app/(marketing)/profile/_hooks/useCreateContribution.tsx
index 877fcca714..abfbc22ee2 100644
--- a/src/app/(marketing)/profile/_hooks/useCreateContribution.tsx
+++ b/src/app/(marketing)/profile/_hooks/useCreateContribution.tsx
@@ -2,10 +2,11 @@ import { useToast } from "@/components/ui/hooks/useToast"
import { Schemas } from "@guildxyz/types"
import { SignedValidation, useSubmitWithSign } from "hooks/useSubmit"
import fetcher from "utils/fetcher"
+import { revalidateContribution } from "../_server_actions/revalidateContribution"
import { useContribution } from "./useContribution"
import { useProfile } from "./useProfile"
-export type EditProfilePayload = Schemas["ProfileContributionUpdate"]
+export type EditProfilePayload = Schemas["ContributionUpdate"]
export const useCreateContribution = () => {
const { toast } = useToast()
@@ -14,7 +15,7 @@ export const useCreateContribution = () => {
const update = async (signedValidation: SignedValidation) => {
return fetcher(
- `/v2/profiles/${(profile as Schemas["Profile"]).id}/contributions`,
+ `/v2/profiles/${(profile as Schemas["Profile"]).username}/contributions`,
{
method: "POST",
...signedValidation,
@@ -22,7 +23,7 @@ export const useCreateContribution = () => {
)
}
- const submitWithSign = useSubmitWithSign(update, {
+ const submitWithSign = useSubmitWithSign(update, {
onSuccess: (response) => {
contribution.mutate(
(prev) => {
@@ -33,6 +34,7 @@ export const useCreateContribution = () => {
},
{ revalidate: false }
)
+ revalidateContribution()
toast({
variant: "success",
title: "Successfully created contribution",
diff --git a/src/app/(marketing)/profile/_hooks/useDeleteContribution.tsx b/src/app/(marketing)/profile/_hooks/useDeleteContribution.tsx
index f438d98554..f69753505e 100644
--- a/src/app/(marketing)/profile/_hooks/useDeleteContribution.tsx
+++ b/src/app/(marketing)/profile/_hooks/useDeleteContribution.tsx
@@ -2,19 +2,20 @@ import { useToast } from "@/components/ui/hooks/useToast"
import { Schemas } from "@guildxyz/types"
import { SignedValidation, useSubmitWithSign } from "hooks/useSubmit"
import fetcher from "utils/fetcher"
+import { revalidateContribution } from "../_server_actions/revalidateContribution"
import { useContribution } from "./useContribution"
import { useProfile } from "./useProfile"
export const useDeleteContribution = ({
contributionId,
-}: { contributionId: Schemas["ProfileContribution"]["id"] }) => {
+}: { contributionId: Schemas["Contribution"]["id"] }) => {
const { toast } = useToast()
const { data: profile } = useProfile()
const contribution = useContribution()
const update = async (signedValidation: SignedValidation) => {
return fetcher(
- `/v2/profiles/${(profile as Schemas["Profile"]).id}/contributions/${contributionId}`,
+ `/v2/profiles/${(profile as Schemas["Profile"]).username}/contributions/${contributionId}`,
{
method: "DELETE",
...signedValidation,
@@ -23,7 +24,7 @@ export const useDeleteContribution = ({
}
const submitWithSign = useSubmitWithSign