mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 05:50:19 +08:00
feat: support storage provider to terms of use file (#221)
Signed-off-by: WindSpiritSR <simon343riley@gmail.com>
This commit is contained in:
@ -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 = () => {
|
||||
|
Reference in New Issue
Block a user