mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 14:09:57 +08:00
feat: finish policy list management (#1317)
This commit is contained in:
@ -70,6 +70,41 @@ export function deleteAdapter(Adapter) {
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function UpdatePolicy(owner, name, policy) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(policy);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-policy?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
body: JSON.stringify(policy),
|
||||
headers: {
|
||||
"Accept-Language": Setting.getAcceptLanguage(),
|
||||
},
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function AddPolicy(owner, name, policy) {
|
||||
return fetch(`${Setting.ServerUrl}/api/add-policy?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
body: JSON.stringify(policy),
|
||||
headers: {
|
||||
"Accept-Language": Setting.getAcceptLanguage(),
|
||||
},
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function RemovePolicy(owner, name, policy) {
|
||||
return fetch(`${Setting.ServerUrl}/api/remove-policy?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
body: JSON.stringify(policy),
|
||||
headers: {
|
||||
"Accept-Language": Setting.getAcceptLanguage(),
|
||||
},
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function syncPolicies(owner, name) {
|
||||
return fetch(`${Setting.ServerUrl}/api/sync-policies?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "GET",
|
||||
|
Reference in New Issue
Block a user