1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +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 React, { useEffect, useState } from 'react';
import projectApi from '../../store/project/api';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { import {
Select, Select,
@ -32,8 +33,7 @@ function AddUserComponent({ roles, addUserToRole }) {
if (q.length > 1) { if (q.length > 1) {
setLoading(true); setLoading(true);
// TODO: Do not hard-code fetch here. // TODO: Do not hard-code fetch here.
const response = await fetch(`api/admin/user-admin/search?q=${q}`); const users = await projectApi.searchProjectUser(q);
const users = await response.json();
setOptions([...users]); setOptions([...users]);
} else { } else {
setOptions([]); setOptions([]);

View File

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