Skip to content
Snippets Groups Projects
Commit e5b01be8 authored by lfr20's avatar lfr20
Browse files

add the necessary href and function method to reject or accept complaint +...

add the necessary href and function method to reject or accept complaint + changed to the real route, just for a moment, to see if it was working
parent b8620a75
Branches
No related tags found
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!40merge admin into develop,!37Merge sistema_admin into Update_Admin_System
......@@ -28,6 +28,11 @@ export function GetOneOfAllUrl(type , filter){
return (api)
}
export function MethodsToComplain(type , id, meth){
const api = `${apiUrl}/${type}/${id}/${meth}`;
return (api)
}
export function GetAll(type){
const api = `${apiUrl}/${type}`
return (api)
......
......@@ -127,12 +127,46 @@ export function Create(api, body) {
})
}
export function HandleComplain(api) {
return new Promise(resolve => {
axios({
method: 'post',
url: api,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json; charset=utf-8',
'access-token': sessionStorage.getItem('@portalmec/accessToken'),
'client': sessionStorage.getItem('@portalmec/clientToken'),
'uid': sessionStorage.getItem('@portalmec/uid'),
'If-None-Match': null
},
}).then(response => {
if (response.status === 200) {
resolve(true)
} else {
resolve(false)
}
SaveNewHeaders(response)
}).catch(err =>{
resolve(false)
})
})
}
export function GetFullList(api, headers) {
return new Promise(resolve => {
axios({
method: 'get',
url: api,
headers: headers
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json; charset=utf-8',
'access-token': sessionStorage.getItem('@portalmec/accessToken'),
'client': sessionStorage.getItem('@portalmec/clientToken'),
'uid': sessionStorage.getItem('@portalmec/uid'),
'If-None-Match': null
},
}).then((res) => {
console.log(res)
if (res.status === 200) {
......@@ -146,9 +180,7 @@ export function GetFullList(api, headers) {
data: {}
})
}
if (headers !== undefined) {
SaveNewHeaders(res)
}
}).catch((err) => {
resolve({
state: false,
......@@ -163,7 +195,14 @@ export function GetSpecificData(api, headers) {
axios({
method: 'get',
url: api,
headers: headers
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json; charset=utf-8',
'access-token': sessionStorage.getItem('@portalmec/accessToken'),
'client': sessionStorage.getItem('@portalmec/clientToken'),
'uid': sessionStorage.getItem('@portalmec/uid'),
'If-None-Match': null
},
}).then((res) => {
console.log(res)
if (res.status === 200) {
......@@ -177,9 +216,7 @@ export function GetSpecificData(api, headers) {
data: {}
})
}
if (headers !== undefined) {
SaveNewHeaders(res)
}
}).catch((err) => {
resolve({
state: false,
......
......@@ -25,6 +25,7 @@ var simcaqAPIDomain = 'https://www.simcaq.c3sl.ufpr.br/api',
apiVersion = 'v1',
simcaqAPIurl = simcaqAPIDomain + '/' + apiVersion
export {apiUrl};
export {apiDomain};
export {simcaqAPIurl}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment