[#21] changed react-script to rebuild

This commit is contained in:
Camille Moussu
2025-07-03 14:48:19 +02:00
parent 65621924a2
commit 47fad76217
13 changed files with 2834 additions and 7259 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import { cp } from "node:fs";
export async function getCalendars(userId: string, opaque_token: string) {
const response = await fetch(
`${process.env.REACT_APP_CALENDAR_BASE_URL}/dav/calendars/${userId}.json?personal=true&sharedDelegationStatus=accepted&sharedPublicSubscription=true&withRights=true`,
`${process.env.PUBLIC_CALENDAR_BASE_URL}/dav/calendars/${userId}.json?personal=true&sharedDelegationStatus=accepted&sharedPublicSubscription=true&withRights=true`,
{
headers: {
Accept: "application/calendar+json",
@@ -16,7 +16,7 @@ export async function getCalendars(userId: string, opaque_token: string) {
export async function getCalendar(id: string, opaque_token: string) {
const response = await fetch(
`${process.env.REACT_APP_CALENDAR_BASE_URL}/dav/calendars/${id}/${id}.json`,
`${process.env.PUBLIC_CALENDAR_BASE_URL}/dav/calendars/${id}/${id}.json`,
{
method: "REPORT",
headers: {
-4
View File
@@ -58,7 +58,6 @@ const CalendarSlice = createSlice({
state,
action: PayloadAction<{ calendarUid: string; event: CalendarEvent }>
) => {
console.log(action.payload);
if (!state[action.payload.calendarUid].events) {
state[action.payload.calendarUid].events = [];
}
@@ -81,10 +80,7 @@ const CalendarSlice = createSlice({
builder.addCase(
getCalendarsAsync.fulfilled,
(state, action: PayloadAction<Record<string, Calendars>>) => {
console.log("ony est!!!!: ", action.payload);
console.log(Object.keys(action.payload));
Object.keys(action.payload).forEach((id) => {
console.log(id);
state[id] = action.payload[id];
});
}
-1
View File
@@ -64,7 +64,6 @@ export function parseCalendarEvent(
}
if (!event.uid || !event.start) {
console.log(event);
throw new Error(`Missing required event fields`);
}
-1
View File
@@ -20,7 +20,6 @@ export function CallbackResume() {
const runCallback = async () => {
try {
const data = await Callback(saved?.code_verifier, saved?.state);
console.log("data:", data);
dispatch(setUserData(data?.userinfo));
dispatch(setTokens(data?.tokenSet));
dispatch(getCalendarsAsync(data?.tokenSet.access_token || ""));
+8 -11
View File
@@ -1,19 +1,18 @@
import * as client from "openid-client";
export const clientConfig = {
url: process.env.REACT_APP_SSO_BASE_URL || "",
client_id: process.env.REACT_APP_SSO_CLIENT_ID || "",
client_secret: process.env.REACT_APP_SSO_CLIENT_SECRET || "",
scope: process.env.REACT_APP_SSO_SCOPE || "",
redirect_uri: process.env.REACT_APP_SSO_REDIRECT_URI || "",
response_type: process.env.REACT_APP_SSO_RESPONSE_TYPE || "",
code_challenge_method: process.env.REACT_APP_SSO_CODE_CHALLENGE_METHOD || "",
url: process.env.PUBLIC_SSO_BASE_URL || "",
client_id: process.env.PUBLIC_SSO_CLIENT_ID || "",
client_secret: process.env.PUBLIC_SSO_CLIENT_SECRET || "",
scope: process.env.PUBLIC_SSO_SCOPE || "",
redirect_uri: process.env.PUBLIC_SSO_REDIRECT_URI || "",
response_type: process.env.PUBLIC_SSO_RESPONSE_TYPE || "",
code_challenge_method: process.env.PUBLIC_SSO_CODE_CHALLENGE_METHOD || "",
post_logout_redirect_uri:
process.env.REACT_APP_SSO_POST_LOGOUT_REDIRECT || "",
process.env.PUBLIC_SSO_POST_LOGOUT_REDIRECT || "",
};
export async function getClientConfig() {
console.log(process.env.REACT_APP_SSO_BASE_URL)
return await client.discovery(
new URL(clientConfig.url),
clientConfig.client_id,
@@ -37,7 +36,6 @@ export async function Auth() {
parameters.state = state;
}
let redirectTo = client.buildAuthorizationUrl(openIdClientConfig, parameters);
console.log(redirectTo);
return { redirectTo, code_verifier, state };
}
@@ -58,7 +56,6 @@ export async function Callback(code_verifier: string, state: any) {
console.log("Callback URL:", currentUrl.toString());
console.log("Code verifier:", code_verifier);
console.log("State:", state);
const tokenSet = await client.authorizationCodeGrant(
openIdClientConfig,
+1 -1
View File
@@ -1,6 +1,6 @@
export default async function getOpenPaasUserId(opaque_token: string) {
const response = await fetch(
`${process.env.REACT_APP_CALENDAR_BASE_URL}/api/user`,
`${process.env.PUBLIC_CALENDAR_BASE_URL}/api/user`,
{
headers: {
Authorization: `Bearer ${opaque_token}`,
-1
View File
@@ -18,7 +18,6 @@ export const userSlice = createSlice({
state.organiserData.cal_address = `mailto:${action.payload.email}`;
},
setTokens: (state, action) => {
console.log(state.tokens);
state.tokens = action.payload;
},
},