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

@ -49,15 +49,23 @@ export const CropperDiv = (props) => {
};
const uploadAvatar = () => {
let canvas = cropper.getCroppedCanvas();
if (canvas === null) {
Setting.showMessage("error", "You must select a picture first!");
return false;
}
// Setting.showMessage("success", "uploading...");
const userId = `${user.owner}/${user.name}`;
UserBackend.uploadFile("avatar", userId, canvas.toDataURL());
return true;
cropper.getCroppedCanvas().toBlob(blob => {
if (blob === null) {
Setting.showMessage("error", "You must select a picture first!");
return false;
}
// Setting.showMessage("success", "uploading...");
const userId = `${user.owner}/${user.name}`;
UserBackend.uploadFile("avatar", userId, blob)
.then((res) => {
if (res.status === "ok") {
window.location.href = "/account";
} else {
Setting.showMessage("error", res.msg);
}
});
return true;
});
}
const showModal = () => {