Merge pull request #50 from KevinMidboe/fix/personal-highscore-page
Fix/personal highscore page
This commit is contained in:
		@@ -120,7 +120,7 @@ const byName = (req, res) => {
 | 
			
		||||
    .then(highscore => res.send({
 | 
			
		||||
      message: `Lottery winnings for name: ${ name }.`,
 | 
			
		||||
      name: highscore.name,
 | 
			
		||||
      wins: highscore.wins
 | 
			
		||||
      highscore: highscore.wins
 | 
			
		||||
    }))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								src/api.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/api.js
									
									
									
									
									
								
							@@ -345,6 +345,19 @@ const historyByDate = (date) => {
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const getWinnerByName = (name) => {
 | 
			
		||||
  const encodedName = encodeURIComponent(name)
 | 
			
		||||
  const url = new URL(`/api/lottery/by-name/${name}`, BASE_URL);
 | 
			
		||||
 | 
			
		||||
  return fetch(url.href).then(resp => {
 | 
			
		||||
   if (resp.ok) {
 | 
			
		||||
    return resp.json();
 | 
			
		||||
   } else {
 | 
			
		||||
    return handleErrors(resp);
 | 
			
		||||
   }
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
  statistics,
 | 
			
		||||
  colorStatistics,
 | 
			
		||||
@@ -377,5 +390,6 @@ export {
 | 
			
		||||
  getAmIWinner,
 | 
			
		||||
  postWineChosen,
 | 
			
		||||
  historyAll,
 | 
			
		||||
  historyByDate
 | 
			
		||||
  historyByDate,
 | 
			
		||||
  getWinnerByName
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user