mirror of
https://github.com/etkecc/synapse-admin.git
synced 2024-11-21 23:35:22 +03:00
Rename homeserver_url to endpoint_url in dataProvider
Change-Id: I86441cd90e9b9b6b04ba2d28fee12a1cfa0684a7
This commit is contained in:
parent
a39033e25b
commit
d812cff5fc
1 changed files with 22 additions and 22 deletions
|
@ -85,8 +85,8 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
const url = `${homeserver_url}?${stringify(query)}`;
|
||||
const endpoint_url = homeserver + res.path;
|
||||
const url = `${endpoint_url}?${stringify(query)}`;
|
||||
|
||||
return jsonClient(url).then(({ json }) => ({
|
||||
data: json[res.data].map(res.map),
|
||||
|
@ -101,8 +101,8 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
return jsonClient(`${homeserver_url}/${params.id}`).then(({ json }) => ({
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return jsonClient(`${endpoint_url}/${params.id}`).then(({ json }) => ({
|
||||
data: res.map(json),
|
||||
}));
|
||||
},
|
||||
|
@ -114,9 +114,9 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return Promise.all(
|
||||
params.ids.map(id => jsonClient(`${homeserver_url}/${id}`))
|
||||
params.ids.map(id => jsonClient(`${endpoint_url}/${id}`))
|
||||
).then(responses => ({
|
||||
data: responses.map(({ json }) => res.map(json)),
|
||||
}));
|
||||
|
@ -141,8 +141,8 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
const url = `${homeserver_url}?${stringify(query)}`;
|
||||
const endpoint_url = homeserver + res.path;
|
||||
const url = `${endpoint_url}?${stringify(query)}`;
|
||||
|
||||
return jsonClient(url).then(({ headers, json }) => ({
|
||||
data: json,
|
||||
|
@ -157,8 +157,8 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
return jsonClient(`${homeserver_url}/${params.data.id}`, {
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return jsonClient(`${endpoint_url}/${params.data.id}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(params.data, filterNullValues),
|
||||
}).then(({ json }) => ({
|
||||
|
@ -173,9 +173,9 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return Promise.all(
|
||||
params.ids.map(id => jsonClient(`${homeserver_url}/${id}`), {
|
||||
params.ids.map(id => jsonClient(`${endpoint_url}/${id}`), {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(params.data, filterNullValues),
|
||||
})
|
||||
|
@ -191,8 +191,8 @@ const dataProvider = {
|
|||
|
||||
const res = resourceMap[resource];
|
||||
|
||||
const homeserver_url = homeserver + res.path;
|
||||
return jsonClient(`${homeserver_url}/${params.data.id}`, {
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return jsonClient(`${endpoint_url}/${params.data.id}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(params.data, filterNullValues),
|
||||
}).then(({ json }) => ({
|
||||
|
@ -209,16 +209,16 @@ const dataProvider = {
|
|||
|
||||
if ("delete" in res) {
|
||||
const del = res["delete"](params.id);
|
||||
const homeserver_url = homeserver + del.endpoint;
|
||||
return jsonClient(homeserver_url, {
|
||||
const endpoint_url = homeserver + del.endpoint;
|
||||
return jsonClient(endpoint_url, {
|
||||
method: del.method,
|
||||
body: JSON.stringify(del.body),
|
||||
}).then(({ json }) => ({
|
||||
data: json,
|
||||
}));
|
||||
} else {
|
||||
const homeserver_url = homeserver + res.path;
|
||||
return jsonClient(`${homeserver_url}/${params.id}`, {
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return jsonClient(`${endpoint_url}/${params.id}`, {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify(params.data, filterNullValues),
|
||||
}).then(({ json }) => ({
|
||||
|
@ -238,8 +238,8 @@ const dataProvider = {
|
|||
return Promise.all(
|
||||
params.ids.map(id => {
|
||||
const del = res["delete"](id);
|
||||
const homeserver_url = homeserver + del.endpoint;
|
||||
return jsonClient(homeserver_url, {
|
||||
const endpoint_url = homeserver + del.endpoint;
|
||||
return jsonClient(endpoint_url, {
|
||||
method: del.method,
|
||||
body: JSON.stringify(del.body),
|
||||
});
|
||||
|
@ -248,10 +248,10 @@ const dataProvider = {
|
|||
data: responses.map(({ json }) => json),
|
||||
}));
|
||||
} else {
|
||||
const homeserver_url = homeserver + res.path;
|
||||
const endpoint_url = homeserver + res.path;
|
||||
return Promise.all(
|
||||
params.ids.map(id =>
|
||||
jsonClient(`${homeserver_url}/${id}`, {
|
||||
jsonClient(`${endpoint_url}/${id}`, {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify(params.data, filterNullValues),
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue