Skip to content
Snippets Groups Projects
Commit 4b43120f authored by Chris Steinmann's avatar Chris Steinmann
Browse files

#301 fix query errors

parent 53fde0eb
No related branches found
No related tags found
2 merge requests!314Merging for 0.8.1 Hotfix,!286Resolve "Transektsteckbrief: Zuweisung/Änderungsmöglichkeit eines Nutzers zum Transekt und seine Rolle zum Transekt"
Pipeline #421039 failed
......@@ -302,10 +302,7 @@ export class TransectService {
* @param userIds ids of users that should be assigned to this transect (in a string array)
*/
public updateUsersForTransect = async (transectId: string, userIds: string[]) => {
let userString = "";
for (const userId of userIds) {
userString = userString + userId + ",";
}
const userString = userIds.join('","');
const query = `mutation {
updateTransect(
input: {
......@@ -335,10 +332,7 @@ export class TransectService {
* @param userRoles roles that should be assigned to this user (in a string array)
*/
public updateUserRolesForTransect = async (userId: string, userRoles: string[]) => {
let userRolesString = "";
for (const userId of userRoles) {
userRolesString = userRolesString + userId + ",";
}
let userRolesString = userRoles.join('","');
const query = `mutation {
updateUser (
input: {
......
......@@ -150,12 +150,12 @@ export default class TransectManagement extends Vue {
for (const user of this.selectedUsers) {
userIds.push(user.toString());
}
return await TransectService.getInstance().updateUsersForTransect(transectId, userIds)
return await TransectService.getInstance().updateUsersForTransect("/transects/" + transectId, userIds)
.then((response: AxiosResponse) => {
const isValidReponse = response && response.data && response.data.data;
if (isValidReponse) {
if (response.data.data.errors) {
this.showFailAlert(response.data.data.errors[0]);
if (response.data.errors) {
this.showFailAlert(response.data.errors[0].message);
} else {
this.showConfirmationAlert();
this.requestTransectProfileData();
......@@ -176,8 +176,8 @@ export default class TransectManagement extends Vue {
.then((response: AxiosResponse) => {
const isValidReponse = response && response.data && response.data.data;
if (isValidReponse) {
if (response.data.data.errors) {
this.showFailAlert(response.data.data.errors[0]);
if (response.data.errors) {
this.showFailAlert(response.data.errors[0].message);
} else {
this.showConfirmationAlert();
this.requestTransectProfileData();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment