1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

fix: add members to project use correct uri

This commit is contained in:
Ivar Conradi Østhus 2021-05-07 09:14:32 +02:00
parent cc54fad3a4
commit 37bd960133
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react';
import projectApi from '../../store/project/api';
import PropTypes from 'prop-types';
import {
Select,
@ -32,8 +33,7 @@ function AddUserComponent({ roles, addUserToRole }) {
if (q.length > 1) {
setLoading(true);
// TODO: Do not hard-code fetch here.
const response = await fetch(`api/admin/user-admin/search?q=${q}`);
const users = await response.json();
const users = await projectApi.searchProjectUser(q);
setOptions([...users]);
} else {
setOptions([]);

View File

@ -66,6 +66,10 @@ function validate(id) {
}).then(throwIfNotSuccess);
}
function searchProjectUser(query) {
return fetch(`${formatApiPath('api/admin/user-admin/search')}?q=${query}`).then(res => res.json())
}
export default {
fetchAll,
create,
@ -75,4 +79,5 @@ export default {
fetchAccess,
addUserToRole,
removeUserFromRole,
searchProjectUser,
};