Skip to content

Commit

Permalink
readd removed code as comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschonti committed Apr 14, 2024
1 parent 129f0b4 commit d0039c0
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,49 @@ export async function addToGroup({ email }: { email: string }) {
}
}

// export async function sendQuestion({
// question,
// slug,
// recaptchaToken,
// userId,
// }: {
// question: string;
// slug: string;
// recaptchaToken: string;
// userId: string;
// }) {
// const isRecaptchaValid = await validateRecaptcha(recaptchaToken);
// if (!isRecaptchaValid) {
// console.error('Recaptcha validation failed');
// return 400;
// }
// if (!question || !slug) {
// return 400;
// }
// const res = await fetch(`https://konf-qna.kir-dev.hu/api/presentation/${slug}/question`, {
// method: 'POST',
// body: JSON.stringify({ content: question, userId }),
// });
// if (res.status === 200) {
// return 201;
// } else if (res.status === 400) {
// return 400;
// }
// return 500;
// }

// async function validateRecaptcha(token: string) {
// const res = await fetch('https://www.google.com/recaptcha/api/siteverify', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// },
// body: `secret=${process.env.RECAPTCHA_SECRET}&response=${token}`,
// });
// const data = await res.json();
// return data.success;
// }

export async function sendQuestion({}: { question: string; slug: string; recaptchaToken: string; userId: string }) {
return 400;
}
10 changes: 10 additions & 0 deletions src/models/get-delay-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { delayData } from '@/models/static/delayData';

// export async function getDelayData() {
// const response = await fetch(`${process.env.BACKEND_URL}/proto/delay`, { cache: 'no-store' });
// if (!response.ok) {
// console.error(response);
// return;
// }
// const data: { delay: number } = await response.json();
// return data.delay;
// }

export function getDelayData(): number {
return delayData.delay;
}
9 changes: 9 additions & 0 deletions src/models/get-index-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import { conferenceData } from '@/models/static/conferenceData';

import { IndexPageData } from './models';

// export async function getIndexData(): Promise<IndexPageData | undefined> {
// const res = await fetch(`${process.env.BACKEND_URL}/conference/index`, { next: { revalidate: 30 * 60 } });
// if (!res.ok) {
// console.error(res);
// return;
// }
// return res.json();
// }

export function getIndexData(): IndexPageData {
return conferenceData;
}
10 changes: 10 additions & 0 deletions src/models/get-presentation-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ import { breaksData } from '@/models/static/breaksData';

import { Break, BreakWithDates, Presentation, PresentationWithDates } from './models';

// async function getPresentationBreaks() {
// const res = await fetch(`${process.env.BACKEND_URL}/proto/breaks`, { next: { revalidate: 30 * 60 } });
// if (!res.ok) {
// console.error(res);
// return;
// }
// return res.json();
// }

export async function getPresentationData(): Promise<(PresentationWithDates | BreakWithDates)[] | undefined> {
const indexData = getIndexData();
if (!indexData || !indexData.presentations) {
return;
}
// const breaks: Presentation[] = await getPresentationBreaks();
const breaks = breaksData as Break[];
if (!breaks) {
return;
Expand Down
9 changes: 9 additions & 0 deletions src/models/get-youtube-video-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import { streamsData } from '@/models/static/streamsData';

import { InterviewData, StreamData } from './models';

// export async function getVideoData(endpoint: string) {
// const response = await fetch(`${process.env.BACKEND_URL}/proto/${endpoint}`, { next: { revalidate: 30 * 60 } });
// if (!response.ok) {
// console.error(response);
// return;
// }
// return await response.json();
// }

export async function getStreams(): Promise<StreamData[] | undefined> {
return streamsData;
}
Expand Down

0 comments on commit d0039c0

Please sign in to comment.