mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 05:50:19 +08:00
chore(style): allow case declarations and ban var
(#987)
* chore(style): allow case declarations * chore(style): ban `var` and prefer `const`
This commit is contained in:
@ -43,7 +43,7 @@ export function getUserApplication(owner, name) {
|
||||
}
|
||||
|
||||
export function updateApplication(owner, name, application) {
|
||||
let newApplication = Setting.deepCopy(application);
|
||||
const newApplication = Setting.deepCopy(application);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-application?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -52,7 +52,7 @@ export function updateApplication(owner, name, application) {
|
||||
}
|
||||
|
||||
export function addApplication(application) {
|
||||
let newApplication = Setting.deepCopy(application);
|
||||
const newApplication = Setting.deepCopy(application);
|
||||
newApplication.organization = "built-in";
|
||||
return fetch(`${Setting.ServerUrl}/api/add-application`, {
|
||||
method: "POST",
|
||||
@ -62,7 +62,7 @@ export function addApplication(application) {
|
||||
}
|
||||
|
||||
export function deleteApplication(application) {
|
||||
let newApplication = Setting.deepCopy(application);
|
||||
const newApplication = Setting.deepCopy(application);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-application`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getCert(owner, name) {
|
||||
}
|
||||
|
||||
export function updateCert(owner, name, cert) {
|
||||
let newCert = Setting.deepCopy(cert);
|
||||
const newCert = Setting.deepCopy(cert);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-cert?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateCert(owner, name, cert) {
|
||||
}
|
||||
|
||||
export function addCert(cert) {
|
||||
let newCert = Setting.deepCopy(cert);
|
||||
const newCert = Setting.deepCopy(cert);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-cert`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addCert(cert) {
|
||||
}
|
||||
|
||||
export function deleteCert(cert) {
|
||||
let newCert = Setting.deepCopy(cert);
|
||||
const newCert = Setting.deepCopy(cert);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-cert`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getModel(owner, name) {
|
||||
}
|
||||
|
||||
export function updateModel(owner, name, model) {
|
||||
let newModel = Setting.deepCopy(model);
|
||||
const newModel = Setting.deepCopy(model);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-model?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateModel(owner, name, model) {
|
||||
}
|
||||
|
||||
export function addModel(model) {
|
||||
let newModel = Setting.deepCopy(model);
|
||||
const newModel = Setting.deepCopy(model);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-model`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addModel(model) {
|
||||
}
|
||||
|
||||
export function deleteModel(model) {
|
||||
let newModel = Setting.deepCopy(model);
|
||||
const newModel = Setting.deepCopy(model);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-model`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getOrganization(owner, name) {
|
||||
}
|
||||
|
||||
export function updateOrganization(owner, name, organization) {
|
||||
let newOrganization = Setting.deepCopy(organization);
|
||||
const newOrganization = Setting.deepCopy(organization);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-organization?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateOrganization(owner, name, organization) {
|
||||
}
|
||||
|
||||
export function addOrganization(organization) {
|
||||
let newOrganization = Setting.deepCopy(organization);
|
||||
const newOrganization = Setting.deepCopy(organization);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-organization`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addOrganization(organization) {
|
||||
}
|
||||
|
||||
export function deleteOrganization(organization) {
|
||||
let newOrganization = Setting.deepCopy(organization);
|
||||
const newOrganization = Setting.deepCopy(organization);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-organization`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getPayment(owner, name) {
|
||||
}
|
||||
|
||||
export function updatePayment(owner, name, payment) {
|
||||
let newPayment = Setting.deepCopy(payment);
|
||||
const newPayment = Setting.deepCopy(payment);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-payment?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updatePayment(owner, name, payment) {
|
||||
}
|
||||
|
||||
export function addPayment(payment) {
|
||||
let newPayment = Setting.deepCopy(payment);
|
||||
const newPayment = Setting.deepCopy(payment);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-payment`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addPayment(payment) {
|
||||
}
|
||||
|
||||
export function deletePayment(payment) {
|
||||
let newPayment = Setting.deepCopy(payment);
|
||||
const newPayment = Setting.deepCopy(payment);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-payment`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getPermission(owner, name) {
|
||||
}
|
||||
|
||||
export function updatePermission(owner, name, permission) {
|
||||
let newPermission = Setting.deepCopy(permission);
|
||||
const newPermission = Setting.deepCopy(permission);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-permission?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updatePermission(owner, name, permission) {
|
||||
}
|
||||
|
||||
export function addPermission(permission) {
|
||||
let newPermission = Setting.deepCopy(permission);
|
||||
const newPermission = Setting.deepCopy(permission);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-permission`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addPermission(permission) {
|
||||
}
|
||||
|
||||
export function deletePermission(permission) {
|
||||
let newPermission = Setting.deepCopy(permission);
|
||||
const newPermission = Setting.deepCopy(permission);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-permission`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getProduct(owner, name) {
|
||||
}
|
||||
|
||||
export function updateProduct(owner, name, product) {
|
||||
let newProduct = Setting.deepCopy(product);
|
||||
const newProduct = Setting.deepCopy(product);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-product?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateProduct(owner, name, product) {
|
||||
}
|
||||
|
||||
export function addProduct(product) {
|
||||
let newProduct = Setting.deepCopy(product);
|
||||
const newProduct = Setting.deepCopy(product);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-product`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addProduct(product) {
|
||||
}
|
||||
|
||||
export function deleteProduct(product) {
|
||||
let newProduct = Setting.deepCopy(product);
|
||||
const newProduct = Setting.deepCopy(product);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-product`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getProvider(owner, name) {
|
||||
}
|
||||
|
||||
export function updateProvider(owner, name, provider) {
|
||||
let newProvider = Setting.deepCopy(provider);
|
||||
const newProvider = Setting.deepCopy(provider);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-provider?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateProvider(owner, name, provider) {
|
||||
}
|
||||
|
||||
export function addProvider(provider) {
|
||||
let newProvider = Setting.deepCopy(provider);
|
||||
const newProvider = Setting.deepCopy(provider);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-provider`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addProvider(provider) {
|
||||
}
|
||||
|
||||
export function deleteProvider(provider) {
|
||||
let newProvider = Setting.deepCopy(provider);
|
||||
const newProvider = Setting.deepCopy(provider);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-provider`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getResource(owner, name) {
|
||||
}
|
||||
|
||||
export function updateResource(owner, name, resource) {
|
||||
let newResource = Setting.deepCopy(resource);
|
||||
const newResource = Setting.deepCopy(resource);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-resource?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateResource(owner, name, resource) {
|
||||
}
|
||||
|
||||
export function addResource(resource) {
|
||||
let newResource = Setting.deepCopy(resource);
|
||||
const newResource = Setting.deepCopy(resource);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-resource`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addResource(resource) {
|
||||
}
|
||||
|
||||
export function deleteResource(resource, provider = "") {
|
||||
let newResource = Setting.deepCopy(resource);
|
||||
const newResource = Setting.deepCopy(resource);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-resource?provider=${provider}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -57,7 +57,7 @@ export function deleteResource(resource, provider = "") {
|
||||
|
||||
export function uploadResource(owner, user, tag, parent, fullFilePath, file, provider = "") {
|
||||
const application = "app-built-in";
|
||||
let formData = new FormData();
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return fetch(`${Setting.ServerUrl}/api/upload-resource?owner=${owner}&user=${user}&application=${application}&tag=${tag}&parent=${parent}&fullFilePath=${encodeURIComponent(fullFilePath)}&provider=${provider}`, {
|
||||
body: formData,
|
||||
|
@ -29,7 +29,7 @@ export function getRole(owner, name) {
|
||||
}
|
||||
|
||||
export function updateRole(owner, name, role) {
|
||||
let newRole = Setting.deepCopy(role);
|
||||
const newRole = Setting.deepCopy(role);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-role?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateRole(owner, name, role) {
|
||||
}
|
||||
|
||||
export function addRole(role) {
|
||||
let newRole = Setting.deepCopy(role);
|
||||
const newRole = Setting.deepCopy(role);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-role`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addRole(role) {
|
||||
}
|
||||
|
||||
export function deleteRole(role) {
|
||||
let newRole = Setting.deepCopy(role);
|
||||
const newRole = Setting.deepCopy(role);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-role`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getSyncer(owner, name) {
|
||||
}
|
||||
|
||||
export function updateSyncer(owner, name, syncer) {
|
||||
let newSyncer = Setting.deepCopy(syncer);
|
||||
const newSyncer = Setting.deepCopy(syncer);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-syncer?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateSyncer(owner, name, syncer) {
|
||||
}
|
||||
|
||||
export function addSyncer(syncer) {
|
||||
let newSyncer = Setting.deepCopy(syncer);
|
||||
const newSyncer = Setting.deepCopy(syncer);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-syncer`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addSyncer(syncer) {
|
||||
}
|
||||
|
||||
export function deleteSyncer(syncer) {
|
||||
let newSyncer = Setting.deepCopy(syncer);
|
||||
const newSyncer = Setting.deepCopy(syncer);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-syncer`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -29,7 +29,7 @@ export function getToken(owner, name) {
|
||||
}
|
||||
|
||||
export function updateToken(owner, name, token) {
|
||||
let newToken = Setting.deepCopy(token);
|
||||
const newToken = Setting.deepCopy(token);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-token?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateToken(owner, name, token) {
|
||||
}
|
||||
|
||||
export function addToken(token) {
|
||||
let newToken = Setting.deepCopy(token);
|
||||
const newToken = Setting.deepCopy(token);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-token`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addToken(token) {
|
||||
}
|
||||
|
||||
export function deleteToken(token) {
|
||||
let newToken = Setting.deepCopy(token);
|
||||
const newToken = Setting.deepCopy(token);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-token`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
@ -37,7 +37,7 @@ export function getUser(owner, name) {
|
||||
}
|
||||
|
||||
export function updateUser(owner, name, user) {
|
||||
let newUser = Setting.deepCopy(user);
|
||||
const newUser = Setting.deepCopy(user);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-user?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -46,7 +46,7 @@ export function updateUser(owner, name, user) {
|
||||
}
|
||||
|
||||
export function addUser(user) {
|
||||
let newUser = Setting.deepCopy(user);
|
||||
const newUser = Setting.deepCopy(user);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-user`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -55,7 +55,7 @@ export function addUser(user) {
|
||||
}
|
||||
|
||||
export function deleteUser(user) {
|
||||
let newUser = Setting.deepCopy(user);
|
||||
const newUser = Setting.deepCopy(user);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-user`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -76,7 +76,7 @@ export function getAffiliationOptions(url, code) {
|
||||
}
|
||||
|
||||
export function setPassword(userOwner, userName, oldPassword, newPassword) {
|
||||
let formData = new FormData();
|
||||
const formData = new FormData();
|
||||
formData.append("userOwner", userOwner);
|
||||
formData.append("userName", userName);
|
||||
formData.append("oldPassword", oldPassword);
|
||||
@ -89,7 +89,7 @@ export function setPassword(userOwner, userName, oldPassword, newPassword) {
|
||||
}
|
||||
|
||||
export function sendCode(checkType, checkId, checkKey, dest, type, applicationId, checkUser) {
|
||||
let formData = new FormData();
|
||||
const formData = new FormData();
|
||||
formData.append("checkType", checkType);
|
||||
formData.append("checkId", checkId);
|
||||
formData.append("checkKey", checkKey);
|
||||
@ -113,7 +113,7 @@ export function sendCode(checkType, checkId, checkKey, dest, type, applicationId
|
||||
}
|
||||
|
||||
export function verifyCaptcha(captchaType, captchaToken, clientSecret) {
|
||||
let formData = new FormData();
|
||||
const formData = new FormData();
|
||||
formData.append("captchaType", captchaType);
|
||||
formData.append("captchaToken", captchaToken);
|
||||
formData.append("clientSecret", clientSecret);
|
||||
@ -137,7 +137,7 @@ export function verifyCaptcha(captchaType, captchaToken, clientSecret) {
|
||||
}
|
||||
|
||||
export function resetEmailOrPhone(dest, type, code) {
|
||||
let formData = new FormData();
|
||||
const formData = new FormData();
|
||||
formData.append("dest", dest);
|
||||
formData.append("type", type);
|
||||
formData.append("code", code);
|
||||
|
@ -24,7 +24,7 @@ export function registerWebauthnCredential() {
|
||||
credentialCreationOptions.publicKey.challenge = webAuthnBufferDecode(credentialCreationOptions.publicKey.challenge);
|
||||
credentialCreationOptions.publicKey.user.id = webAuthnBufferDecode(credentialCreationOptions.publicKey.user.id);
|
||||
if (credentialCreationOptions.publicKey.excludeCredentials) {
|
||||
for (var i = 0; i < credentialCreationOptions.publicKey.excludeCredentials.length; i++) {
|
||||
for (let i = 0; i < credentialCreationOptions.publicKey.excludeCredentials.length; i++) {
|
||||
credentialCreationOptions.publicKey.excludeCredentials[i].id = webAuthnBufferDecode(credentialCreationOptions.publicKey.excludeCredentials[i].id);
|
||||
}
|
||||
}
|
||||
@ -33,9 +33,9 @@ export function registerWebauthnCredential() {
|
||||
});
|
||||
})
|
||||
.then((credential) => {
|
||||
let attestationObject = credential.response.attestationObject;
|
||||
let clientDataJSON = credential.response.clientDataJSON;
|
||||
let rawId = credential.rawId;
|
||||
const attestationObject = credential.response.attestationObject;
|
||||
const clientDataJSON = credential.response.clientDataJSON;
|
||||
const rawId = credential.rawId;
|
||||
return fetch(`${Setting.ServerUrl}/api/webauthn/signup/finish`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -54,7 +54,7 @@ export function registerWebauthnCredential() {
|
||||
}
|
||||
|
||||
export function deleteUserWebAuthnCredential(credentialID) {
|
||||
let form = new FormData();
|
||||
const form = new FormData();
|
||||
form.append("credentialID", credentialID);
|
||||
|
||||
return fetch(`${Setting.ServerUrl}/api/webauthn/delete-credential`, {
|
||||
|
@ -29,7 +29,7 @@ export function getWebhook(owner, name) {
|
||||
}
|
||||
|
||||
export function updateWebhook(owner, name, webhook) {
|
||||
let newWebhook = Setting.deepCopy(webhook);
|
||||
const newWebhook = Setting.deepCopy(webhook);
|
||||
return fetch(`${Setting.ServerUrl}/api/update-webhook?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -38,7 +38,7 @@ export function updateWebhook(owner, name, webhook) {
|
||||
}
|
||||
|
||||
export function addWebhook(webhook) {
|
||||
let newWebhook = Setting.deepCopy(webhook);
|
||||
const newWebhook = Setting.deepCopy(webhook);
|
||||
return fetch(`${Setting.ServerUrl}/api/add-webhook`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
@ -47,7 +47,7 @@ export function addWebhook(webhook) {
|
||||
}
|
||||
|
||||
export function deleteWebhook(webhook) {
|
||||
let newWebhook = Setting.deepCopy(webhook);
|
||||
const newWebhook = Setting.deepCopy(webhook);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-webhook`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
|
Reference in New Issue
Block a user