code added
Esse commit está contido em:
externo
+28
-29
@@ -1,7 +1,9 @@
|
||||
// let SERVERNAME = 'https://anwi.bizgaze.app';
|
||||
//let SERVERNAME = 'https://anwi.bizgaze.app';
|
||||
let SERVERNAME = 'https://beta.bizgaze.app';
|
||||
//let SERVERNAME = 'http://localhost:3088';
|
||||
const STAT = 'b276960fddf84e8cb63de6e32d31529b';
|
||||
|
||||
|
||||
|
||||
async function getStatAPIService(url,data={}){
|
||||
let config = {
|
||||
url,
|
||||
@@ -33,14 +35,13 @@ async function postStatAPIService(url,data={}){
|
||||
}
|
||||
|
||||
|
||||
async function postAPIServiceWarranty(url,data={}){
|
||||
let SERVERURL = 'https://anwi.bizgaze.app';
|
||||
async function postAPIService(url,data={}){
|
||||
let config = {
|
||||
url:`${SERVERURL}/${url}`,
|
||||
url:`${SERVERNAME}/${url}`,
|
||||
method:'post',
|
||||
data:data,
|
||||
headers: {
|
||||
'Authorization': `Basic 6cdcfe22-1623-4740-97e0-363d518c0e8a`,
|
||||
'Authorization': `Basic fffe5440-5be6-4c07-876f-113c13de7382`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}
|
||||
@@ -48,27 +49,15 @@ async function postAPIServiceWarranty(url,data={}){
|
||||
|
||||
return response;
|
||||
}
|
||||
async function postAPIService(url,data={}){
|
||||
let SERVERURL = 'https://beta.bizgaze.app';
|
||||
//let SERVERURL = 'http://localhost:3088';
|
||||
let config = {
|
||||
url:`${SERVERURL}/${url}`,
|
||||
method:'post',
|
||||
data:data,
|
||||
}
|
||||
let response = await axios(config);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
async function postAPIServiceLocal(url,data={}){
|
||||
let config = {
|
||||
url:`${SERVERNAME}/${url}`,
|
||||
method:'post',
|
||||
data:JSON.stringify(data),
|
||||
data:JSON.stringify(data ),
|
||||
headers: {
|
||||
'Authorization': `Basic c86af480-b5ef-43af-8ce9-503e5b831e2e`,
|
||||
'Authorization': `Basic fffe5440-5be6-4c07-876f-113c13de7382`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}
|
||||
@@ -77,12 +66,12 @@ async function postAPIServiceLocal(url,data={}){
|
||||
return response;
|
||||
}
|
||||
async function getAPIServiceLocal(url){
|
||||
let SERVERURL = 'https://anwi.bizgaze.app';
|
||||
let config = {
|
||||
url:`${SERVERURL}/${url}`,
|
||||
url:`${SERVERNAME}/${url}`,
|
||||
method:'get',
|
||||
|
||||
headers: {
|
||||
'Authorization': `Basic ed40b74d-561a-47af-b03b-4f29c5ff6937`,
|
||||
'Authorization': `Basic fffe5440-5be6-4c07-876f-113c13de7382`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}
|
||||
@@ -126,7 +115,7 @@ class API_SERVICE_CLASS{
|
||||
if(!cookieData) return window.location.href = "/"
|
||||
}
|
||||
let token = isStat ?`stat ${this.statToken}` : `Basic ${cookieData.token}`;
|
||||
// let token = isStat ?`stat ${this.statToken}` : `Basic ${this.token}`;
|
||||
this.token = token;
|
||||
let successResFun = this.buildSuccessResponse;
|
||||
let failureResFun = this.buildFailureResponse;
|
||||
let config = {
|
||||
@@ -150,7 +139,7 @@ class API_SERVICE_CLASS{
|
||||
return successResFun(response.data)
|
||||
}
|
||||
if(response.data.code == '417'){
|
||||
window.location.href = '/index.html'
|
||||
// window.location.href = '/index.html'
|
||||
return failureResFun(response.data)
|
||||
}
|
||||
if(response.data.code != '0'){
|
||||
@@ -168,7 +157,6 @@ class API_SERVICE_CLASS{
|
||||
|
||||
}
|
||||
|
||||
|
||||
buildURL(url){
|
||||
return `${this.baseURL}/${url}`;
|
||||
}
|
||||
@@ -243,6 +231,10 @@ class API_SERVICE_CLASS{
|
||||
if(!cookieData){
|
||||
return justGetAPIService('/Account/Session/Validate')
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -277,8 +269,10 @@ class COOKIE_HELPER_CLASS{
|
||||
|
||||
removeCookie(token){
|
||||
Cookies.remove(token)
|
||||
}
|
||||
async validateToken() {
|
||||
}
|
||||
|
||||
|
||||
async validateToken(){
|
||||
return await API_SERVICES_ACTIONS.getAPIService(`Account/Session/Validate`)
|
||||
}
|
||||
}
|
||||
@@ -290,6 +284,8 @@ const COOKIE_HELPER_ACTIONS ={
|
||||
setCookie :COOKIE_HELPER.setCookie,
|
||||
removeAuthCookie:COOKIE_HELPER.removeCookie.bind(null,AUTH)
|
||||
}
|
||||
|
||||
|
||||
function setCookieManual(token){
|
||||
Cookies.set(AUTH,{
|
||||
token,
|
||||
@@ -299,9 +295,9 @@ function setCookieManual(token){
|
||||
|
||||
async function checkValidAuth(cb,redirect=undefined){
|
||||
debugger;
|
||||
|
||||
document.querySelector('auth-loader').show();
|
||||
const res = await COOKIE_HELPER.validateToken();
|
||||
debugger
|
||||
if(!res.response){
|
||||
if(redirect){
|
||||
window.location.href =redirect;
|
||||
@@ -318,3 +314,6 @@ async function checkValidAuth(cb,redirect=undefined){
|
||||
cb();
|
||||
},300);
|
||||
}
|
||||
|
||||
|
||||
// setCookieManual('6eb70fee-35ef-4ca2-95cd-01ebdd616eb1');
|
||||
externo
+1
@@ -131,6 +131,7 @@ function initLogin() {
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
});
|
||||
// setInitLoginLocal();
|
||||
window.localStorage.setItem("Useremail", userEmail);
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário