feat: update service queries to use getAllServiziData for improved data handling
This commit is contained in:
parent
79354f3833
commit
8c7f0cd9b3
4 changed files with 5 additions and 15 deletions
|
|
@ -67,7 +67,7 @@ export const AllegatiComp = ({
|
||||||
await utils.storage.retrieveUserFileData.invalidate({
|
await utils.storage.retrieveUserFileData.invalidate({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
});
|
});
|
||||||
await utils.servizio.getAllServizioAnnunci.invalidate({ userId });
|
await utils.servizio.getAllServiziData.invalidate({ userId });
|
||||||
|
|
||||||
toast.success(t.allegati.allegato_rimosso, {
|
toast.success(t.allegati.allegato_rimosso, {
|
||||||
icon: "🗑️",
|
icon: "🗑️",
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ export const AdminDashboard = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserDashboard = ({ userId }: { userId: UsersId }) => {
|
export const UserDashboard = ({ userId }: { userId: UsersId }) => {
|
||||||
const { data, isLoading } = api.servizio.getServizioRinnovi.useQuery({
|
const { data, isLoading } = api.servizio.getAllServiziData.useQuery({
|
||||||
userId,
|
userId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ type RicercaUserProps = {
|
||||||
const RicercaUser: NextPageWithLayout<RicercaUserProps> = ({
|
const RicercaUser: NextPageWithLayout<RicercaUserProps> = ({
|
||||||
userId,
|
userId,
|
||||||
}: RicercaUserProps) => {
|
}: RicercaUserProps) => {
|
||||||
const { data, isLoading } = api.servizio.getServizioRinnovi.useQuery({
|
const { data, isLoading } = api.servizio.getAllServiziData.useQuery({
|
||||||
userId,
|
userId,
|
||||||
});
|
});
|
||||||
if (isLoading) return <LoadingPage />;
|
if (isLoading) return <LoadingPage />;
|
||||||
|
|
@ -59,7 +59,7 @@ export const getServerSideProps = (async (context) => {
|
||||||
await helpers.trpc.intrests.getUserInterestsAnnunci.prefetch({
|
await helpers.trpc.intrests.getUserInterestsAnnunci.prefetch({
|
||||||
userId: parsed.data,
|
userId: parsed.data,
|
||||||
});
|
});
|
||||||
await helpers.trpc.servizio.getAllServizioAnnunci.prefetch({
|
await helpers.trpc.servizio.getAllServiziData.prefetch({
|
||||||
userId: parsed.data,
|
userId: parsed.data,
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -124,16 +124,6 @@ export const servizioRouter = createTRPCRouter({
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
return await getDataPerAcquisto(input.servizioId);
|
return await getDataPerAcquisto(input.servizioId);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getAllServizioAnnunci: protectedProcedure
|
|
||||||
.input(
|
|
||||||
z.object({
|
|
||||||
userId: zUserId,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.query(async ({ input }) => {
|
|
||||||
return await getAllServizioAnnunci(input.userId);
|
|
||||||
}),
|
|
||||||
getRichieste: adminProcedure.query(async () => {
|
getRichieste: adminProcedure.query(async () => {
|
||||||
return await getRichieste();
|
return await getRichieste();
|
||||||
}),
|
}),
|
||||||
|
|
@ -420,7 +410,7 @@ export const servizioRouter = createTRPCRouter({
|
||||||
servizioId: input.servizioId,
|
servizioId: input.servizioId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
getServizioRinnovi: protectedProcedure
|
getAllServiziData: protectedProcedure
|
||||||
.input(
|
.input(
|
||||||
z.object({
|
z.object({
|
||||||
userId: zUserId,
|
userId: zUserId,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue