Skip to content

Commit

Permalink
Merge pull request #675 from bounswe/674-mobile-connect-forum-pages-t…
Browse files Browse the repository at this point in the history
…o-backend

674 mobile connect forum pages to backend
  • Loading branch information
aoengin authored Nov 26, 2024
2 parents 16d7361 + 8e5d6e1 commit 1e318d9
Show file tree
Hide file tree
Showing 5 changed files with 547 additions and 284 deletions.
12 changes: 10 additions & 2 deletions mobile/bulingo/app/(tabs)/forums/forumPostCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
import { FontAwesome } from '@expo/vector-icons';
import { router } from 'expo-router';
import { createPost } from '@/app/api/forum';

const ForumPostCreation = () => {
const [title, setTitle] = useState('');
Expand All @@ -16,10 +17,17 @@ const ForumPostCreation = () => {
router.back();
};

const handleCreatePost = () => {
const handleCreatePost = async () => {

// Handle post creation logic here
console.log('Post Created:', { title, content });
try {
await createPost(title, content, ["vocab", "business"]);
console.log('Post Created:', { title, content });
router.back();
} catch (error) {
console.error('Failed to create post:', error);
}

};

const isButtonDisabled = !title || !content ;
Expand Down
Loading

0 comments on commit 1e318d9

Please sign in to comment.