first working state
This commit is contained in:
		
							parent
							
								
									0a9b76f9c7
								
							
						
					
					
						commit
						4a0db151d4
					
				
					 23 changed files with 512 additions and 74 deletions
				
			
		|  | @ -1,11 +1,21 @@ | |||
| import { getUserBorders } from "../../../../lib/borders"; | ||||
| import { getUserBorders, setUserBorder } from "../../../../lib/borders"; | ||||
| 
 | ||||
| export default function handler(req, res) { | ||||
|   getUserBorders(req).then((result) => { | ||||
|     if (result) { | ||||
|       return res.status(200).json(result); | ||||
|     } else { | ||||
|       return res.status(404).json({ error: "Not Found" }); | ||||
|     } | ||||
|   }); | ||||
|   if (req.method === "POST") { | ||||
|     setUserBorder(req, req.body).then((result) => { | ||||
|       if (result) { | ||||
|         return res.status(200).json(result); | ||||
|       } else { | ||||
|         return res.status(500).json({ error: "could not update border" }); | ||||
|       } | ||||
|     }); | ||||
|   } else { | ||||
|     getUserBorders(req).then((result) => { | ||||
|       if (result) { | ||||
|         return res.status(200).json(result); | ||||
|       } else { | ||||
|         return res.status(404).json({ error: "Not Found" }); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue