#63: Added general user editing ability for users

This commit is contained in:
frikky
2020-06-22 14:24:33 +02:00
parent ec9254ffa2
commit d4cbccd47e
5 changed files with 124 additions and 88 deletions
+3 -2
View File
@@ -72,7 +72,7 @@ const Admin = (props) => {
const onPasswordChange = () => {
const data = {"username": selectedUser.username, "newpassword": newPassword}
const url = globalUrl+'/api/v1/passwordchange';
const url = globalUrl+'/api/v1/users/passwordchange';
fetch(url, {
mode: 'cors',
method: 'POST',
@@ -135,7 +135,7 @@ const Admin = (props) => {
// Just use this one?
var data = {"username": data.Username, "password": data.Password}
var baseurl = globalUrl
const url = baseurl+'/api/v1/register';
const url = baseurl+'/api/v1/users/register';
fetch(url, {
method: 'POST',
credentials: "include",
@@ -296,6 +296,7 @@ const Admin = (props) => {
return response.json()
})
.then((responseJson) => {
console.log(responseJson)
setUsers(responseJson)
})
.catch(error => {
+1 -1
View File
@@ -84,7 +84,7 @@ const App = (message, props) => {
const checkLogin = () => {
var baseurl = globalUrl
fetch(baseurl+"/api/v1/getinfo", {
fetch(baseurl+"/api/v1/users/getinfo", {
credentials: "include",
headers: {
'Content-Type': 'application/json',
+2 -2
View File
@@ -92,7 +92,7 @@ const LoginDialog = props => {
var data = {"username": username, "password": password}
var baseurl = globalUrl
if (register) {
var url = baseurl+'/api/v1/login';
var url = baseurl+'/api/v1/users/login';
fetch(url, {
mode: 'cors',
method: 'POST',
@@ -123,7 +123,7 @@ const LoginDialog = props => {
setLoginInfo("Error in userdata: " + error)
});
} else {
url = baseurl+'/api/v1/register';
url = baseurl+'/api/v1/users/register';
fetch(url, {
method: 'POST',
body: JSON.stringify(data),