Initial commit
This commit is contained in:
		
							
								
								
									
										40
									
								
								src/common/stores/transportationStore.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/common/stores/transportationStore.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
import { observable, action, computed } from 'mobx';
 | 
			
		||||
 | 
			
		||||
export default class TransportationModule {
 | 
			
		||||
	@observable transportationList = [];
 | 
			
		||||
	@observable transportationId = "";
 | 
			
		||||
	@observable transportationDetail = {
 | 
			
		||||
	  	id : '',
 | 
			
		||||
		name : '',
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@observable isLoading = false;
 | 
			
		||||
	
 | 
			
		||||
	constructor(context) {
 | 
			
		||||
	    this.http = context.http;
 | 
			
		||||
	    this.context = context;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@action
 | 
			
		||||
	getAll(){
 | 
			
		||||
		this.isLoading = true;
 | 
			
		||||
		return this.http.get(`transportations`).then(res => {
 | 
			
		||||
			this.transportationList = res;
 | 
			
		||||
			// console.log(this.transportationList);
 | 
			
		||||
			this.isLoading = false;
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@action
 | 
			
		||||
	getById(id){
 | 
			
		||||
		this.transportationId = id;
 | 
			
		||||
		this.isLoading = true;
 | 
			
		||||
		return this.http.get(`transportations?id=${id}`).then(detail => {
 | 
			
		||||
			this.transportationDetail = detail[0];
 | 
			
		||||
			this.isLoading = false;
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user