Formatting entire project
This commit is contained in:
		
							parent
							
								
									74a5b3930b
								
							
						
					
					
						commit
						a97e9779d1
					
				
					 8 changed files with 30 additions and 27 deletions
				
			
		|  | @ -23,9 +23,9 @@ export function NewPostContainer(): JSX.Element { | |||
|         onPress={() => { | ||||
|           if (currentInput.length > 0) { | ||||
|             const p: NewPost = { | ||||
|                 content: currentInput, | ||||
|                 token: "token" | ||||
|             } | ||||
|               content: currentInput, | ||||
|               token: "token", | ||||
|             }; | ||||
|             createPost(p); | ||||
|             setCurrentInput(""); | ||||
|           } else { | ||||
|  |  | |||
|  | @ -10,10 +10,6 @@ import { style } from "../util/style"; | |||
|  * @returns {JSX.Element} The JSX for the Post | ||||
|  */ | ||||
| export function PostView({ post }: { post: Post }): JSX.Element { | ||||
|   // WARNING THIS IS NOT ACCEPTABLE WARNING REMOVE WARNING
 | ||||
|   // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|   // const [thisPost, setThisPost] = React.useState<Post>(post);
 | ||||
| 
 | ||||
|   return ( | ||||
|     <View style={style.postView}> | ||||
|       <Text style={style.postFont}>{post.id + " " + post.content}</Text> | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ export function PostsContainer(): JSX.Element { | |||
|       setPage(0); | ||||
|       setPostData(await getPostsInterval(0, 10)); | ||||
|     } | ||||
|     setPostData([]) | ||||
|     setPostData([]); | ||||
|     fetchPosts(); | ||||
|   } | ||||
| 
 | ||||
|  | @ -57,7 +57,9 @@ export function PostsContainer(): JSX.Element { | |||
|       <VirtualizedList | ||||
|         data={postData} | ||||
|         initialNumToRender={4} | ||||
|         renderItem={({ item }) => <PostView key={item.id + item.createdAt} post={item} />} | ||||
|         renderItem={({ item }) => ( | ||||
|           <PostView key={item.id + item.createdAt} post={item} /> | ||||
|         )} | ||||
|         keyExtractor={(item: Post) => item.id + item.createdAt} | ||||
|         getItemCount={getItemCount} | ||||
|         getItem={getItem} | ||||
|  |  | |||
|  | @ -56,7 +56,10 @@ export async function getPosts(): Promise<Post[]> { | |||
|   return data; | ||||
| } | ||||
| 
 | ||||
| export async function getPostsInterval(offset: number, limit: number): Promise<Post[]> { | ||||
| export async function getPostsInterval( | ||||
|   offset: number, | ||||
|   limit: number, | ||||
| ): Promise<Post[]> { | ||||
|   const res = await fetch(URL + `/api/posts?offset=${offset}&limit=${limit}`); | ||||
|   const data = await res.json(); | ||||
|   return data; | ||||
|  | @ -104,7 +107,7 @@ export async function createPost(post: NewPost): Promise<void> { | |||
| export async function submitRegistration( | ||||
|   username: string, | ||||
|   password: string, | ||||
|   captcha: string | ||||
|   captcha: string, | ||||
| ): Promise<AuthResponse | undefined> { | ||||
|   const response = await fetch(URL + "/api/register", { | ||||
|     method: "POST", | ||||
|  | @ -125,7 +128,7 @@ export async function submitRegistration( | |||
|  */ | ||||
| export async function submitLogin( | ||||
|   username: string, | ||||
|   password: string | ||||
|   password: string, | ||||
| ): Promise<AuthResponse | undefined> { | ||||
|   if (username == "" || password == "") return; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus