BicepBuddyApp/src/main/java/User/UserController.java
public void deleteAccount(User u) {
		// Actually Delete a User from the DB
		// Open the post response
		HttpDelete request = new HttpDelete(baseUrl + user.getId());

		try {
			// Set headers
			request.addHeader("content-type", "application/json");
			request.addHeader("Authorization", "Bearer " + user.getJwt());
			request.addHeader("id", user.getId());

			// Execute the request
			HttpResponse response = httpClient.execute(request);

			// Get the Respose Back
		    if(response.getStatusLine().getStatusCode() == 200) {
		    	// User Profile was Deleted!
		    	Master.appLogger.info(":: Deleting user " + user.getfName() + " " + user.getlName() + " from DB.");
		    	user = null;
		    	Master.getInstance().loggedOutMenuLoad();
		    	Master.getInstance().updateFrame(new Login());
		    } else {
		    	new ErrorGUI("You don't have access to this action!");
		    }

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			request.releaseConnection();
		}
	}
/**
	 * Delete account from the settings page and update database.
	 *
	 * @param u the u
	 */
Delete account from the settings page and update database.
@param u the u
Delete account from the settings page and update database . @param u the u
public void deleteAccount(User u) {
		HttpDelete request = new HttpDelete(baseUrl + user.getId());
		try {
			request.addHeader("content-type", "application/json");
			request.addHeader("Authorization", "Bearer " + user.getJwt());
			request.addHeader("id", user.getId());
			HttpResponse response = httpClient.execute(request);
		    if(response.getStatusLine().getStatusCode() == 200) {
		    	Master.appLogger.info(":: Deleting user " + user.getfName() + " " + user.getlName() + " from DB.");
		    	user = null;
		    	Master.getInstance().loggedOutMenuLoad();
		    	Master.getInstance().updateFrame(new Login());
		    } else {
		    	new ErrorGUI("You don't have access to this action!");
		    }
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			request.releaseConnection();
		}
	}
public void deleteAccount ( User u ) { HttpDelete request = new HttpDelete ( baseUrl + user . getId ( ) ) ; try { request . addHeader ( "content-type" , "application/json" ) ; request . addHeader ( "Authorization" , "Bearer " + user . getJwt ( ) ) ; request . addHeader ( "id" , user . getId ( ) ) ; HttpResponse response = httpClient . execute ( request ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) == 200 ) { Master . appLogger . info ( ":: Deleting user " + user . getfName ( ) + " " + user . getlName ( ) + " from DB." ) ; user = null ; Master . getInstance ( ) . loggedOutMenuLoad ( ) ; Master . getInstance ( ) . updateFrame ( new Login ( ) ) ; } else { new ErrorGUI ( "You don't have access to this action!" ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { request . releaseConnection ( ) ; } }
Delete account from the settings page and update database.
Delete account from the settings page and update database .
// Actually Delete a User from the DB // Open the post response // Set headers // Execute the request // Get the Respose Back // User Profile was Deleted!