5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
6
< title > Edit Scratch Coding Hut Wiki</ title >
7
7
< style >
8
- /* Global reset */
9
- * {
10
- margin : 0 ;
11
- padding : 0 ;
12
- box-sizing : border-box;
13
- }
14
-
15
- body {
16
- font-family : 'Arial' , sans-serif;
17
- background : # fff4f4 ;
18
- color : # 333 ;
19
- padding : 40px ;
20
- display : flex;
21
- flex-direction : column;
22
- align-items : center;
23
- text-align : center;
24
- }
25
-
26
- h1 {
27
- font-size : 3rem ;
28
- color : # ff4d4d ;
29
- margin-bottom : 30px ;
30
- font-weight : bold;
31
- }
32
-
33
- .form-container {
34
- background-color : # ffcccc ;
35
- padding : 30px ;
36
- border-radius : 10px ;
37
- box-shadow : 0px 4px 10px rgba (0 , 0 , 0 , 0.1 );
38
- width : 100% ;
39
- max-width : 500px ;
40
- margin-bottom : 30px ;
41
- }
42
-
43
- .form-container h2 {
44
- font-size : 1.5rem ;
45
- color : # e60000 ;
46
- margin-bottom : 20px ;
47
- }
48
-
49
- input , textarea {
50
- width : 100% ;
51
- padding : 15px ;
52
- margin-bottom : 15px ;
53
- border-radius : 8px ;
54
- border : 2px solid # e60000 ;
55
- font-size : 1rem ;
56
- outline : none;
57
- }
58
-
59
- input : focus , textarea : focus {
60
- border-color : # ff4d4d ;
61
- box-shadow : 0 0 5px rgba (255 , 77 , 77 , 0.5 );
62
- }
63
-
64
- button {
65
- background-color : # ff4d4d ;
66
- color : white;
67
- padding : 15px 30px ;
68
- border : none;
69
- border-radius : 8px ;
70
- cursor : pointer;
71
- font-size : 1.1rem ;
72
- transition : background-color 0.3s ease;
73
- }
74
-
75
- button : hover {
76
- background-color : # ff1a1a ;
77
- }
78
-
79
- /* Mobile Responsive Styling */
80
- @media (max-width : 768px ) {
81
- .form-container {
82
- width : 90% ;
83
- padding : 20px ;
84
- }
85
-
86
- h1 {
87
- font-size : 2.5rem ;
88
- }
89
-
90
- button {
91
- font-size : 1rem ;
92
- padding : 12px 25px ;
93
- }
94
- }
8
+ /* Your existing CSS styles here */
95
9
</ style >
96
10
</ head >
97
11
< body >
@@ -163,6 +77,11 @@ <h2>Edit Wiki Post</h2>
163
77
}
164
78
165
79
try {
80
+ // Log to verify the values being sent
81
+ console . log ( 'Updating wiki with ID:' , wikiId ) ;
82
+ console . log ( 'Updated Title:' , updatedTitle ) ;
83
+ console . log ( 'Updated Content:' , updatedContent ) ;
84
+
166
85
const response = await fetch ( `${ backendUrl } /wikis/${ wikiId } ` , {
167
86
method : 'PUT' ,
168
87
headers : { 'Content-Type' : 'application/json' } ,
@@ -175,7 +94,7 @@ <h2>Edit Wiki Post</h2>
175
94
176
95
if ( response . ok ) {
177
96
alert ( 'Wiki updated successfully!' ) ;
178
- window . location . href = 'sitemaplinks.html' ; // Redirect to Wiki/wiki.html after saving
97
+ window . location . href = 'sitemaplinks.html' ; // Redirect to Wiki list page after saving
179
98
} else {
180
99
const errorDetails = await response . json ( ) ;
181
100
console . error ( 'Failed to update wiki:' , errorDetails ) ;
0 commit comments