182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
13 setIsLoading(true);
14 try {
15 const response = await fetch("/generate", {
16 method: "POST",
17 headers: { "Content-Type": "application/json" },
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
125 setLoading(true);
126 try {
127 const res = await fetch("/api/generate", {
128 method: "POST",
129 body: JSON.stringify({ prompt }),
19 const handleGenerate = async () => {
20 try {
21 const response = await fetch('/generate', {
22 method: 'POST',
23 body: JSON.stringify({ longUrl }),
11 setLoading(true);
12 try {
13 const response = await fetch('/grammar', {
14 method: 'POST',
15 body: JSON.stringify({ text })
166
167 try {
168 const response = await fetch("/", {
169 method: "POST",
170 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
114 }
115
116 const response = await fetch('/submit-vote', {
117 method: 'POST',
118 headers: { 'Content-Type': 'application/json' },
307
308 useEffect(() => {
309 async function fetchVotes() {
310 const response = await fetch('/get-votes');
311 const data = await response.json();
312 setVotes(data);
322 setLoading(false);
323 }
324 fetchVotes();
325 }, []);
326
327 const handleDeleteVote = async (id: number) => {
328 const response = await fetch('/delete-vote', {
329 method: 'POST',
330 headers: { 'Content-Type': 'application/json' },
76
77 try {
78 const response = await fetch("/api/generate-question", {
79 method: "POST",
80 headers: { "Content-Type": "application/json" },
106
107 try {
108 const response = await fetch("/api/generate-exam-questions", {
109 method: "POST",
110 headers: { "Content-Type": "application/json" },
143
144 try {
145 const response = await fetch("/api/get-feedback", {
146 method: "POST",
147 headers: { "Content-Type": "application/json" },
176
177 try {
178 const response = await fetch("/api/get-exam-feedback", {
179 method: "POST",
180 headers: { "Content-Type": "application/json" },