Spookie/assets/controllers/crop_avatar_controller.js

35 lines
686 B
JavaScript

import { Controller } from '@hotwired/stimulus'
import Swal from 'sweetalert2'
export default class extends Controller {
static values = {
cropImage: String
}
connect() {
console.log('crop', this.cropImageValue)
window.CropAvatar = this
}
open() {
console.log('open crop')
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success',
)
}
})
}
}