feat: support storage provider to terms of use file (#221)

Signed-off-by: WindSpiritSR <simon343riley@gmail.com>
This commit is contained in:
WindSpiritSR
2021-08-10 10:43:33 +08:00
committed by Yang Luo
parent 718fc4df74
commit 8c6f0a31b6
9 changed files with 113 additions and 55 deletions

View File

@ -13,6 +13,7 @@
// limitations under the License.
import * as Setting from "../Setting";
import * as AuthBackend from "../auth/AuthBackend";
export function getApplications(owner) {
return fetch(`${Setting.ServerUrl}/api/get-applications?owner=${owner}`, {

View File

@ -79,18 +79,11 @@ export function getAffiliationOptions(url, code) {
export function uploadFile(folder, subFolder, file) {
let formData = new FormData();
formData.append("file", file);
fetch(`${Setting.ServerUrl}/api/upload-file?folder=${encodeURIComponent(folder)}&subFolder=${encodeURIComponent(subFolder)}`, {
return fetch(`${Setting.ServerUrl}/api/upload-file?folder=${encodeURIComponent(folder)}&subFolder=${encodeURIComponent(subFolder)}`, {
body: formData,
method: 'POST',
credentials: 'include',
}).then(res => res.json())
.then((res) => {
if (res.status === "ok") {
window.location.href = "/account";
} else {
Setting.showMessage("error", res.msg);
}
});
}
export function setPassword(userOwner, userName, oldPassword, newPassword) {