/api/backupProduct
This commit is contained in:
		
							parent
							
								
									be6240d0d5
								
							
						
					
					
						commit
						3ec0bd90ec
					
				| 
						 | 
				
			
			@ -373,7 +373,7 @@ Route.post("/api/gitea-webhook", ({ request, response }) => {
 | 
			
		|||
});
 | 
			
		||||
 | 
			
		||||
Route.post("/api/backupProduct", async ({ request, response }) => {
 | 
			
		||||
  try {
 | 
			
		||||
  // try {
 | 
			
		||||
    const date = moment(Date.now()).format("YYYYMMDD");
 | 
			
		||||
    const token =
 | 
			
		||||
      "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c2VyIjoxLCJ1c2VybmFtZSI6ImVycHVzZXIiLCJjcmVhdGVkQXQiOiIyMDIzLTA4LTIzVDE1OjI4OjAxLjAwMCsxMDowMCIsInVwZGF0ZWRBdCI6IjIwMjMtMDgtMjNUMTU6Mjg6MDEuMDAwKzEwOjAwIiwiaWF0IjoxNjk1MjY0NTQwLCJleHAiOjE3MjY4MDA1NDB9.vBlZAc7TGKbOrsP7UjQzVY2hIoJCGXQDe3KUxYyv294";
 | 
			
		||||
| 
						 | 
				
			
			@ -398,7 +398,7 @@ Route.post("/api/backupProduct", async ({ request, response }) => {
 | 
			
		|||
    const addProduct = await Product.createMany(res.data)
 | 
			
		||||
    console.log(addProduct)
 | 
			
		||||
    response.status(200).send("Add "+res.data.length+" success!");
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    response.status(500).send(error);
 | 
			
		||||
  }
 | 
			
		||||
  // } catch (error) {
 | 
			
		||||
  //   response.status(500).send(error);
 | 
			
		||||
  // }
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue