@@ -14,7 +14,11 @@ export function UnsubscribePage() {
1414 const subscriberId = searchParams . get ( "sid" )
1515 const campaignId = searchParams . get ( "cid" )
1616
17- const unsubscribeUser = trpc . subscriber . unsubscribe . useMutation ( {
17+ const {
18+ mutate : unsubscribeUser ,
19+ isSuccess,
20+ isPending,
21+ } = trpc . subscriber . unsubscribe . useMutation ( {
1822 onError : ( error ) => {
1923 setError ( error . message )
2024 } ,
@@ -36,10 +40,10 @@ export function UnsubscribePage() {
3640 }
3741
3842 const handleUnsubscribe = ( ) => {
39- unsubscribeUser . mutate ( { sid : subscriberId , cid : campaignId } )
43+ unsubscribeUser ( { sid : subscriberId , cid : campaignId } )
4044 }
4145
42- if ( unsubscribeUser . isSuccess ) {
46+ if ( isSuccess ) {
4347 return (
4448 < PageWrapper >
4549 < div className = "flex justify-center" >
@@ -71,6 +75,8 @@ export function UnsubscribePage() {
7175 < Button
7276 onClick = { handleUnsubscribe }
7377 variant = "destructive"
78+ disabled = { isPending }
79+ loading = { isPending }
7480 className = "w-full bg-red-500 hover:bg-red-600"
7581 >
7682 < MailX className = "w-4 h-4 mr-2" />
@@ -94,11 +100,11 @@ const PageWrapper = ({ children }: { children: React.ReactNode }) => (
94100 < footer className = "mt-8 text-sm text-gray-500" >
95101 < Link
96102 to = { constants . GITHUB_URL }
97- className = "flex items-center hover:text-gray-300 transition-colors"
103+ className = "flex items-center hover:text-gray-300 transition-colors gap-1 "
98104 target = "_blank"
99105 rel = "noopener noreferrer"
100106 >
101- < IconBrandGithub className = "w-4 h-4 mr-2 " />
107+ < IconBrandGithub className = "w-4 h-4" />
102108 Powered by < LetterSpaceText as = "span" />
103109 </ Link >
104110 </ footer >
0 commit comments