disable add to calendar button
This commit is contained in:
@ -560,7 +560,7 @@ async function DeleteSchedule(axios: Axios, date: Date, forDay: Boolean | undefi
|
|||||||
|
|
||||||
async function CreateCalendarForUser(eventId: string | string[] | undefined) {
|
async function CreateCalendarForUser(eventId: string | string[] | undefined) {
|
||||||
try {
|
try {
|
||||||
CAL.authorizeNew();
|
//CAL.authorizeNew();
|
||||||
CAL.createEvent(eventId);
|
CAL.createEvent(eventId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -87,8 +87,10 @@ export default function MySchedulePage({ assignments }) {
|
|||||||
<dt className="text-sm font-medium text-gray-500">Действия</dt>
|
<dt className="text-sm font-medium text-gray-500">Действия</dt>
|
||||||
<dd className="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd className="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
<button
|
<button
|
||||||
className="mr-2 mb-2 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"
|
className="mr-2 mb-2 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled"
|
||||||
onClick={() => AddToGoogleCalendar(assignment.id)}
|
disabled={true}
|
||||||
|
// disabled={assignment.isInGoogleCalendar}
|
||||||
|
onClick={() => SaveEventsInGoogleCalendar(assignment)}
|
||||||
>
|
>
|
||||||
Добави в календар
|
Добави в календар
|
||||||
</button>
|
</button>
|
||||||
@ -128,7 +130,6 @@ export default function MySchedulePage({ assignments }) {
|
|||||||
onChange={(publisher) => {
|
onChange={(publisher) => {
|
||||||
setIsConfirmModalOpen(true);
|
setIsConfirmModalOpen(true);
|
||||||
setNewPublisher(publisher);
|
setNewPublisher(publisher);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
showAllAuto={true}
|
showAllAuto={true}
|
||||||
showSearch={true}
|
showSearch={true}
|
||||||
|
@ -474,7 +474,24 @@ createEvent = async (event) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SaveEventsInGoogleCalendar = async function SaveEventsInGoogleCalendar(events) {
|
||||||
|
// Load client secrets from a local file.
|
||||||
|
try {
|
||||||
|
const content = await fs.readFile(CREDENTIALS_PATH);
|
||||||
|
// Authorize a client with credentials, then call the Google Calendar API.
|
||||||
|
authorize(JSON.parse(content), createEvent);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error loading client secret file:", err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.GenerateICS = GenerateICS;
|
exports.GenerateICS = GenerateICS;
|
||||||
exports.createEvent = createEvent;
|
exports.createEvent = createEvent;
|
||||||
|
exports.SaveEventsInGoogleCalendar = SaveEventsInGoogleCalendar;
|
||||||
|
|
||||||
createEvent();
|
|
||||||
|
//createEvent();
|
||||||
|
Reference in New Issue
Block a user