Commit 8d1a9fe5 authored by Max Alekseenko's avatar Max Alekseenko

add toast

parent 9324fa13
...@@ -6,6 +6,7 @@ import type { UserRatings, AppRatings } from 'types/client/marketplace'; ...@@ -6,6 +6,7 @@ import type { UserRatings, AppRatings } from 'types/client/marketplace';
import config from 'configs/app'; import config from 'configs/app';
import useApiQuery from 'lib/api/useApiQuery'; import useApiQuery from 'lib/api/useApiQuery';
import useToast from 'lib/hooks/useToast';
import { ADDRESS_COUNTERS } from 'stubs/address'; import { ADDRESS_COUNTERS } from 'stubs/address';
const feature = config.features.marketplace; const feature = config.features.marketplace;
...@@ -15,6 +16,7 @@ const base = (feature.isEnabled && feature.rating) ? ...@@ -15,6 +16,7 @@ const base = (feature.isEnabled && feature.rating) ?
export default function useRatings() { export default function useRatings() {
const { address } = useAccount(); const { address } = useAccount();
const toast = useToast();
const addressCountersQuery = useApiQuery<'address_counters', { status: number }>('address_counters', { const addressCountersQuery = useApiQuery<'address_counters', { status: number }>('address_counters', {
pathParams: { hash: address }, pathParams: { hash: address },
...@@ -103,10 +105,15 @@ export default function useRatings() { ...@@ -103,10 +105,15 @@ export default function useRatings() {
}, },
]); ]);
setUserRatings({ ...userRatings, [appId]: rating }); setUserRatings({ ...userRatings, [appId]: rating });
toast({
status: 'success',
title: 'Awesome! Thank you 💜',
description: 'Your rating improves the service',
});
fetchRatings(); fetchRatings();
} catch (error) {} } catch (error) {}
setIsSending(false); setIsSending(false);
}, [ address, userRatings, fetchRatings ]); }, [ address, userRatings, fetchRatings, toast ]);
return { return {
ratings, ratings,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment