mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add provider to file API.
This commit is contained in:
@ -89,20 +89,27 @@ class ResourceListPage extends React.Component {
|
||||
|
||||
renderTable(resources) {
|
||||
const columns = [
|
||||
{
|
||||
title: i18next.t("general:Provider"),
|
||||
dataIndex: 'provider',
|
||||
key: 'provider',
|
||||
width: '150px',
|
||||
fixed: 'left',
|
||||
sorter: (a, b) => a.provider.localeCompare(b.provider),
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<Link to={`/providers/${text}`}>
|
||||
{text}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: i18next.t("general:Name"),
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
width: '150px',
|
||||
fixed: 'left',
|
||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||
// render: (text, record, index) => {
|
||||
// return (
|
||||
// <Link to={`/resources/${text}`}>
|
||||
// {text}
|
||||
// </Link>
|
||||
// )
|
||||
// }
|
||||
},
|
||||
{
|
||||
title: i18next.t("general:Created time"),
|
||||
|
@ -46,19 +46,19 @@ export function addResource(resource) {
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function deleteResource(resource) {
|
||||
export function deleteResource(resource, provider="") {
|
||||
let newResource = Setting.deepCopy(resource);
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-resource`, {
|
||||
return fetch(`${Setting.ServerUrl}/api/delete-resource?provider=${provider}`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(newResource),
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function uploadResource(owner, tag, parent, fullFilePath, file) {
|
||||
export function uploadResource(owner, tag, parent, fullFilePath, file, provider="") {
|
||||
let formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return fetch(`${Setting.ServerUrl}/api/upload-resource?owner=${owner}&tag=${tag}&parent=${parent}&fullFilePath=${encodeURIComponent(fullFilePath)}`, {
|
||||
return fetch(`${Setting.ServerUrl}/api/upload-resource?owner=${owner}&tag=${tag}&parent=${parent}&fullFilePath=${encodeURIComponent(fullFilePath)}&provider=${provider}`, {
|
||||
body: formData,
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
|
Reference in New Issue
Block a user