mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 05:50:19 +08:00
Add application list and edit pages.
This commit is contained in:
42
web/src/backend/ApplicationBackend.js
Normal file
42
web/src/backend/ApplicationBackend.js
Normal file
@ -0,0 +1,42 @@
|
||||
import * as Setting from "../Setting";
|
||||
|
||||
export function getApplications(owner) {
|
||||
return fetch(`${Setting.ServerUrl}/api/get-applications?owner=${owner}`, {
|
||||
method: "GET",
|
||||
credentials: "include"
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function getApplication(owner, name) {
|
||||
return fetch(`${Setting.ServerUrl}/api/get-application?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "GET",
|
||||
credentials: "include"
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function updateApplication(owner, name, application) {
|
||||
let newApplication = Setting.deepCopy(application);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-application?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(newApplication),
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function addApplication(application) {
|
||||
let newApplication = Setting.deepCopy(application);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-application`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(newApplication),
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function deleteApplication(application) {
|
||||
let newApplication = Setting.deepCopy(application);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-application`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(newApplication),
|
||||
}).then(res => res.json());
|
||||
}
|
Reference in New Issue
Block a user