refactor: remove console.log statements for cleaner code
This commit is contained in:
parent
899289f6f8
commit
25e4e15eec
4 changed files with 2 additions and 14 deletions
|
|
@ -45,7 +45,7 @@ import { UserAvatar } from "../user_avatar";
|
||||||
|
|
||||||
export const Appunti = () => {
|
export const Appunti = () => {
|
||||||
const { data, columns, setData, removeColumn } = useAppunti();
|
const { data, columns, setData, removeColumn } = useAppunti();
|
||||||
console.log("Appunti data:", data);
|
|
||||||
return (
|
return (
|
||||||
<ScrollArea className="w-screen pr-2 sm:w-full">
|
<ScrollArea className="w-screen pr-2 sm:w-full">
|
||||||
<KanbanProvider
|
<KanbanProvider
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ type AppuntiContextType = {
|
||||||
data: AppuntiData[];
|
data: AppuntiData[];
|
||||||
columns: AppuntiGroups[];
|
columns: AppuntiGroups[];
|
||||||
setData: (data: AppuntiData[]) => void;
|
setData: (data: AppuntiData[]) => void;
|
||||||
updateCall: () => void;
|
|
||||||
addItem: (item: NewAppunti) => void;
|
addItem: (item: NewAppunti) => void;
|
||||||
removeItem: (id: AppuntiId) => void;
|
removeItem: (id: AppuntiId) => void;
|
||||||
removeColumn: (id: AppuntiGroupsId) => void;
|
removeColumn: (id: AppuntiGroupsId) => void;
|
||||||
|
|
@ -69,7 +69,6 @@ export const AppuntiProvider = ({ children }: AppuntiProviderProps) => {
|
||||||
...item,
|
...item,
|
||||||
posizione: index,
|
posizione: index,
|
||||||
}));
|
}));
|
||||||
console.log("Setting data with positions:", dataWithPositions);
|
|
||||||
utils.appunti.getAppunti.setData(undefined, dataWithPositions);
|
utils.appunti.getAppunti.setData(undefined, dataWithPositions);
|
||||||
updateAppuntiMutation({
|
updateAppuntiMutation({
|
||||||
data: dataWithPositions,
|
data: dataWithPositions,
|
||||||
|
|
@ -83,14 +82,6 @@ export const AppuntiProvider = ({ children }: AppuntiProviderProps) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateCall = () => {
|
|
||||||
const data = utils.appunti.getAppunti.getData();
|
|
||||||
console.log("Updating Appunti with data:", data);
|
|
||||||
// updateAppuntiMutation({
|
|
||||||
// data: data || [],
|
|
||||||
// });
|
|
||||||
};
|
|
||||||
|
|
||||||
const { mutate: addColumnMutation } = api.appunti.addAppuntiGroup.useMutation(
|
const { mutate: addColumnMutation } = api.appunti.addAppuntiGroup.useMutation(
|
||||||
{
|
{
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
|
|
@ -140,7 +131,6 @@ export const AppuntiProvider = ({ children }: AppuntiProviderProps) => {
|
||||||
data: data || [],
|
data: data || [],
|
||||||
columns: columns || [],
|
columns: columns || [],
|
||||||
setData,
|
setData,
|
||||||
updateCall,
|
|
||||||
addItem,
|
addItem,
|
||||||
removeItem,
|
removeItem,
|
||||||
addColumn,
|
addColumn,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ export const appuntiRouter = createTRPCRouter({
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.mutation(async ({ input }) => {
|
.mutation(async ({ input }) => {
|
||||||
console.log(input.data);
|
|
||||||
return await updateAppunti(input.data);
|
return await updateAppunti(input.data);
|
||||||
}),
|
}),
|
||||||
updateAppunto: adminProcedure
|
updateAppunto: adminProcedure
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,6 @@ export const updateAppunti = async (data: AppuntiData[]) => {
|
||||||
...item,
|
...item,
|
||||||
posizione: index,
|
posizione: index,
|
||||||
}));
|
}));
|
||||||
console.log("Data with positions to update:", dataWithPositions);
|
|
||||||
|
|
||||||
for (const item of dataWithPositions) {
|
for (const item of dataWithPositions) {
|
||||||
const { column, username: _username, ...rest } = item;
|
const { column, username: _username, ...rest } = item;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue