Fix makeshift solution for changing cawangan

This commit is contained in:
Afiq Hamzah
2023-12-03 11:47:52 +08:00
parent ed823fe411
commit 03fa84b143
+15 -11
View File
@@ -1,7 +1,7 @@
<template>
<div class="mx-auto">
<a v-if="route === 'ada'" class="text-yellow-200 rounded bg-gray-400 px-6 py-3 font-bold mr-4 uppercase sm:invisible lg:visible xl:visible">
CAWANGAN :
CAWANGAN :
<select v-model="caw" @change="tukarcawangan" class="rounded-md border bg-gray-400 font-bold border-gray-400 focus:outline-none rounded-md focus:ring-1 ring-cyan-500 uppercase">
<option v-for="(caw,i) in cawangan" :key="i" :value="caw.kodcaw">{{ caw.details_caw }}</option>
</select>
@@ -33,17 +33,21 @@
},
created() {
this.caw = this.$kodcaw
this.caw = this.$kodcaw
this.axios.get('/api/check/cawangan').then(response => {
this.cawangan = response.data;
});
fetch('/api/check/cawangan')
.then(response => response.json()).then(response => this.cawangan = response);
},
methods:{
tukarcawangan: function(){
this.setkodcaw(this.caw)
// this.sethostname(this.caw)
this.pembahagiancawangan(this.caw)
@@ -66,8 +70,8 @@
}
return namcaw;
},
pembahagiancawangan: function(cawangannama){
switch (cawangannama) {
@@ -85,7 +89,7 @@
case 'JLI':
case 'ARP':
case '020303':{
this.sethostname('http://api.arrahn')
this.sethostname('http://192.168.0.27:8083')
break;
}
case '010621':
@@ -99,9 +103,9 @@
case '011013':
case '011412':{
// this.$hostname = 'http://api2.arrahn'
this.sethostname('http://api2.arrahn')
this.sethostname('http://192.168.0.27:8083')
break;
}
}
case '011229':
case '011230':
case '011227':
@@ -112,10 +116,10 @@
case '011237':
case '011233':{
// this.$hostname = 'http://api3.arrahn'
this.sethostname('http://api2.arrahn')
this.sethostname('http://192.168.0.27:8083')
break;
}
default: this.sethostname('http://api.arrahn')
default: this.sethostname('http://192.168.0.27:8083')
break;
}
}