added login and sign Funtion properly
This commit is contained in:
@ -88,9 +88,9 @@ const testFunctionSignup = async () => {
|
||||
isError.value = false;
|
||||
errorMsg.value = '';
|
||||
|
||||
const username = 'maria'
|
||||
const password = 'maria123'
|
||||
const password_repeat = 'maria123'
|
||||
const username = 'franzzzzzrtg'
|
||||
const password = '112345678'
|
||||
const password_repeat = '112345678'
|
||||
const fullName = 'hallo'
|
||||
const email = 'test.sdj@web.de'
|
||||
const phonenumber = '015736283729'
|
||||
@ -126,11 +126,10 @@ const testFunctionSignup = async () => {
|
||||
let res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/signup`, requestBody);
|
||||
|
||||
// something to do with the res?
|
||||
console.log(res.data)
|
||||
console.log(res)
|
||||
|
||||
} catch (err) {
|
||||
// handle the error
|
||||
// console.log(err)
|
||||
console.log(err.response.statusText)
|
||||
isError.value = true;
|
||||
errorMsg.value = err.response.statusText;
|
||||
|
||||
@ -9,8 +9,14 @@
|
||||
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Client:</pre>
|
||||
<pre v-if="!editable"
|
||||
:class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']"> {{ item.customer }}</pre>
|
||||
<input v-if="editable" v-model="item.customer" @change="updateConfigItem()"
|
||||
:class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']">
|
||||
<!-- <input v-if="editable" v-model="item.customer" @change="updateCustomerID()"
|
||||
:class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']"> -->
|
||||
<select v-if="editable" id="customersDropDownChosenCI" v-model="item.customer"
|
||||
@change="updateCustomerID()" :class="[darkMode ? 'select-darkmode' : 'select-lightmode']">
|
||||
<option v-for="cust in customers" :key="cust.primaryID">
|
||||
{{ cust.customername }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="data-field" id="location">
|
||||
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Location:</pre>
|
||||
@ -89,6 +95,9 @@ const deleteAssetBool = computed(() => store.state.deleteAsset)
|
||||
|
||||
const darkMode = ref(true)
|
||||
const item = ref({});
|
||||
const customer = ref({});
|
||||
const configItems = ref([]);
|
||||
const customers = ref([]);
|
||||
|
||||
// get config item from id
|
||||
const getItemById = async () => {
|
||||
@ -109,13 +118,13 @@ const updateConfigItem = async () => {
|
||||
return;
|
||||
} else {
|
||||
var counter = 0;
|
||||
//later check if ci already exists
|
||||
// for (let key in item.value) {
|
||||
// if (this.configItems[key].assetName === this.item.assetName) {
|
||||
// counter += 1;
|
||||
// }
|
||||
// }
|
||||
if (counter == 1) {
|
||||
// check if config item name already exists
|
||||
configItems.value.forEach(ci => {
|
||||
if (ci.assetName === item.value.assetName) {
|
||||
counter += 1;
|
||||
}
|
||||
});
|
||||
if (counter == 2) {
|
||||
alert("This asset name already exists. Please choose an unique asset name or modify respectively delete the old one!");
|
||||
return;
|
||||
}
|
||||
@ -160,6 +169,17 @@ const updateConfigItem = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
//get all customers
|
||||
const getCustomers = async () => {
|
||||
try {
|
||||
const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllCustomers`
|
||||
);
|
||||
customers.value = response.data;
|
||||
} catch (err) {
|
||||
console.log(err.response.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
const confirmDeleteAsset = async () => {
|
||||
if (deleteAssetBool.value === true) {
|
||||
if (confirm("Do you really want to delete this config item? It cannot be undone!")) {
|
||||
@ -176,10 +196,34 @@ const confirmDeleteAsset = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
//get all config items
|
||||
const getConfigItems = async () => {
|
||||
try {
|
||||
const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllConfigItems`);
|
||||
configItems.value = response.data;
|
||||
} catch (err) {
|
||||
console.log(err.response.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
// update customerid if customer was changed
|
||||
const updateCustomerID = async () => {
|
||||
try {
|
||||
const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCustomerByName/${item.value.customer}`);
|
||||
customer.value = response.data;
|
||||
item.value.customerID = customer.value.customerID;
|
||||
} catch (err) {
|
||||
console.log(err.response.statusText);
|
||||
}
|
||||
await updateConfigItem();
|
||||
}
|
||||
|
||||
watch(deleteAssetBool, confirmDeleteAsset);
|
||||
|
||||
onMounted(() => {
|
||||
getItemById();
|
||||
getConfigItems();
|
||||
getCustomers();
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -397,4 +441,20 @@ export default {
|
||||
.rectangle-lightmode {
|
||||
background-color: #EBEBEB;
|
||||
}
|
||||
|
||||
.select-darkmode {
|
||||
border: none;
|
||||
color: white;
|
||||
background: #212121;
|
||||
padding: 0.4rem;
|
||||
border-radius: 0.3125rem;
|
||||
}
|
||||
|
||||
.select-lightmode {
|
||||
border: none;
|
||||
color: black;
|
||||
background: #EBEBEB;
|
||||
padding: 0.4rem;
|
||||
border-radius: 0.3125rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user