mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	 9fb0dfa4a7
			
		
	
	9fb0dfa4a7
	
	
	
		
			
			### Tools list <img width="2316" height="666" alt="CleanShot 2025-10-03 at 20 42 41@2x" src="https://github.com/user-attachments/assets/ccbffd16-804d-4eb8-9c64-2d1cfd407e4e" /> ### Tools form <img width="2294" height="2202" alt="CleanShot 2025-10-03 at 20 43 05@2x" src="https://github.com/user-attachments/assets/9f49aa09-75a1-4585-a09d-837ca64139b8" /> ## Response <img width="800" height="2144" alt="CleanShot 2025-10-03 at 20 45 56@2x" src="https://github.com/user-attachments/assets/b0c3c899-6050-4c51-baed-c8fbec5aae61" /> --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Pranav <pranav@chatwoot.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import CaptainCustomTools from 'dashboard/api/captain/customTools';
 | |
| import { createStore } from './storeFactory';
 | |
| import { throwErrorMessage } from 'dashboard/store/utils/api';
 | |
| 
 | |
| export default createStore({
 | |
|   name: 'CaptainCustomTool',
 | |
|   API: CaptainCustomTools,
 | |
|   actions: mutations => ({
 | |
|     update: async ({ commit }, { id, ...updateObj }) => {
 | |
|       commit(mutations.SET_UI_FLAG, { updatingItem: true });
 | |
|       try {
 | |
|         const response = await CaptainCustomTools.update(id, updateObj);
 | |
|         commit(mutations.EDIT, response.data);
 | |
|         commit(mutations.SET_UI_FLAG, { updatingItem: false });
 | |
|         return response.data;
 | |
|       } catch (error) {
 | |
|         commit(mutations.SET_UI_FLAG, { updatingItem: false });
 | |
|         return throwErrorMessage(error);
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     delete: async ({ commit }, id) => {
 | |
|       commit(mutations.SET_UI_FLAG, { deletingItem: true });
 | |
|       try {
 | |
|         await CaptainCustomTools.delete(id);
 | |
|         commit(mutations.DELETE, id);
 | |
|         commit(mutations.SET_UI_FLAG, { deletingItem: false });
 | |
|         return id;
 | |
|       } catch (error) {
 | |
|         commit(mutations.SET_UI_FLAG, { deletingItem: false });
 | |
|         return throwErrorMessage(error);
 | |
|       }
 | |
|     },
 | |
|   }),
 | |
| });
 |