Refactor imports (#470)

This commit is contained in:
Camille Moussu
2026-01-20 17:33:30 +01:00
committed by GitHub
parent aeb8670895
commit 23d50f250d
149 changed files with 1439 additions and 1374 deletions
@@ -0,0 +1,50 @@
import { getUserDetails } from "@/features/User/userAPI";
import { formatReduxError } from "@/utils/errorUtils";
import { createAsyncThunk } from "@reduxjs/toolkit";
import { postCalendar } from "../CalendarApi";
import { RejectedError } from "../CalendarSlice";
export const createCalendarAsync = createAsyncThunk<
{
userId: string;
calId: string;
color: Record<string, string>;
name: string;
desc: string;
owner: string;
ownerEmails: string[];
},
{
userId: string;
calId: string;
color: Record<string, string>;
name: string;
desc: string;
},
{ rejectValue: RejectedError }
>(
"calendars/createCalendar",
async ({ userId, calId, color, name, desc }, { rejectWithValue }) => {
try {
await postCalendar(userId, calId, color, name, desc);
const ownerData: any = await getUserDetails(userId.split("/")[0]);
return {
userId,
calId,
color,
name,
desc,
owner: [ownerData.firstname, ownerData.lastname]
.filter(Boolean)
.join(" "),
ownerEmails: ownerData.emails ?? [],
};
} catch (err: any) {
return rejectWithValue({
message: formatReduxError(err),
status: err.response?.status,
});
}
}
);