slcing registrasi awal

This commit is contained in:
2024-10-31 15:53:59 +07:00
parent 54f56d9602
commit 8d24534928
27 changed files with 1079 additions and 854 deletions

View File

@@ -1,7 +1,7 @@
// const URL = "/westone-api/v1/system/auth";
const URL = "https://devcpone.aplikasi.web.id/westone-api/v1/system/auth/";
// const URL = "https://devcpone.aplikasi.web.id/westone-api/v1/system/auth";
const apiURL = "http://localhost:8080/api/v1/auth";
const store = {
namespaced: true,
@@ -63,12 +63,12 @@ const store = {
message: window.i18n.global.t('message.msgInfo')
}
let params = {
username: state.email,
email: state.email,
password: state.password
};
console.log(params);
try {
const response = await axios.post(URL + '/login', params);
const response = await axios.post(apiURL + '/login', params);
console.log(response.data)
if (response.data.status != 'OK') {
commit('setLoading', false);
@@ -81,13 +81,19 @@ const store = {
} else {
commit('setLoading', false);
commit('setData', response.data.data);
localStorage.setItem("token", response.data.data.token)
localStorage.setItem('user', JSON.stringify(response.data.data.user))
localStorage.setItem("token", response.data.token)
localStorage.setItem('user', JSON.stringify(response.data.data))
//console.log(localStorage.getItem("token"))
// if (data.user.is_courier === 'Y' && window.innerWidth < 600)
// window.location = "/one-ui/test/vuex/one-courier-mobile/";
// else
// window.location = "/" + response.data.data.user.M_UserGroupDashboard;
if (response.data.type === 'westone') {
} else {
window.location.href = "/auth-code";
}
}
commit('setAlert', alert)
@@ -97,6 +103,9 @@ const store = {
}
},
async loginGoogle() {
window.location.href = apiURL + "/google/login"
},
async loginState({ state, commit }) {
commit('setLoading', true);
const params = {
@@ -105,7 +114,7 @@ const store = {
};
try {
const response = await axios.post(URL + '/login', params);
const response = await axios.post(apiURL + '/login', params);
if (response.status != 'OK') {
commit('setLoading', false);
@@ -121,7 +130,7 @@ const store = {
},
async LoginParam({ commit }, params) {
try {
const response = await axios.post(URL + '/login', params);
const response = await axios.post(apiURL + '/login', params);
commit('setData', response.data);
} catch (error) {
commit('setError', error);