Formatting
This commit is contained in:
		
							parent
							
								
									47ce986834
								
							
						
					
					
						commit
						14b68e4463
					
				
					 1 changed files with 10 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -1,9 +1,5 @@
 | 
			
		|||
import React, { useState } from "react";
 | 
			
		||||
import { api } from "../API/API";
 | 
			
		||||
import InputField from "./InputField";
 | 
			
		||||
import BackButton from "./BackButton";
 | 
			
		||||
import Button from "./Button";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function ChangeUsername(): JSX.Element {
 | 
			
		||||
  const [newUsername, setNewUsername] = useState("");
 | 
			
		||||
| 
						 | 
				
			
			@ -12,16 +8,16 @@ function ChangeUsername(): JSX.Element {
 | 
			
		|||
    setNewUsername(e.target.value);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const handleSubmit = async (): Promise<void> => {
 | 
			
		||||
    try {
 | 
			
		||||
      // Call the API function to update the username
 | 
			
		||||
      await api.updateUsername(newUsername);
 | 
			
		||||
      // Optionally, add a success message or redirect the user
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      console.error("Error updating username:", error);
 | 
			
		||||
      // Optionally, handle the error
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  // const handleSubmit = async (): Promise<void> => {
 | 
			
		||||
  //   try {
 | 
			
		||||
  //     // Call the API function to update the username
 | 
			
		||||
  //     await api.updateUsername(newUsername);
 | 
			
		||||
  //     // Optionally, add a success message or redirect the user
 | 
			
		||||
  //   } catch (error) {
 | 
			
		||||
  //     console.error("Error updating username:", error);
 | 
			
		||||
  //     // Optionally, handle the error
 | 
			
		||||
  //   }
 | 
			
		||||
  // };
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue