diff options
Diffstat (limited to 'frontend/src/pages/Rules.tsx')
| -rw-r--r-- | frontend/src/pages/Rules.tsx | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/frontend/src/pages/Rules.tsx b/frontend/src/pages/Rules.tsx index 9f57b7e..7a774bc 100644 --- a/frontend/src/pages/Rules.tsx +++ b/frontend/src/pages/Rules.tsx | |||
| @@ -5,37 +5,35 @@ import { Helmet } from 'react-helmet'; | |||
| 5 | import '@css/Rules.css'; | 5 | import '@css/Rules.css'; |
| 6 | 6 | ||
| 7 | const Rules: React.FC = () => { | 7 | const Rules: React.FC = () => { |
| 8 | const [rulesText, setRulesText] = React.useState<string>(''); | ||
| 8 | 9 | ||
| 9 | const [rulesText, setRulesText] = React.useState<string>(""); | 10 | React.useEffect(() => { |
| 11 | const fetchRules = async () => { | ||
| 12 | try { | ||
| 13 | const response = await fetch( | ||
| 14 | 'https://raw.githubusercontent.com/pektezol/lphub/main/RULES.md' | ||
| 15 | ); | ||
| 16 | if (!response.ok) { | ||
| 17 | throw new Error('Failed to fetch README'); | ||
| 18 | } | ||
| 19 | const rulesText = await response.text(); | ||
| 20 | setRulesText(rulesText); | ||
| 21 | } catch (error) { | ||
| 22 | console.error('Error fetching Rules:', error); | ||
| 23 | } | ||
| 24 | // setRulesText(rulesText) | ||
| 25 | }; | ||
| 26 | fetchRules(); | ||
| 27 | }, []); | ||
| 10 | 28 | ||
| 11 | React.useEffect(() => { | 29 | return ( |
| 12 | const fetchRules = async () => { | 30 | <main> |
| 13 | try { | 31 | <Helmet> |
| 14 | const response = await fetch( | 32 | <title>LPHUB | Rules</title> |
| 15 | 'https://raw.githubusercontent.com/pektezol/lphub/main/RULES.md' | 33 | </Helmet> |
| 16 | ); | 34 | <ReactMarkdown>{rulesText}</ReactMarkdown> |
| 17 | if (!response.ok) { | 35 | </main> |
| 18 | throw new Error('Failed to fetch README'); | 36 | ); |
| 19 | } | ||
| 20 | const rulesText = await response.text(); | ||
| 21 | setRulesText(rulesText); | ||
| 22 | } catch (error) { | ||
| 23 | console.error('Error fetching Rules:', error); | ||
| 24 | } | ||
| 25 | // setRulesText(rulesText) | ||
| 26 | }; | ||
| 27 | fetchRules(); | ||
| 28 | }, []); | ||
| 29 | |||
| 30 | |||
| 31 | return ( | ||
| 32 | <main> | ||
| 33 | <Helmet> | ||
| 34 | <title>LPHUB | Rules</title> | ||
| 35 | </Helmet> | ||
| 36 | <ReactMarkdown>{rulesText}</ReactMarkdown> | ||
| 37 | </main> | ||
| 38 | ); | ||
| 39 | }; | 37 | }; |
| 40 | 38 | ||
| 41 | export default Rules; | 39 | export default Rules; |