You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
343 B
14 lines
343 B
export default def upload_json_file e
|
|
return new Promise! do |resolve|
|
|
let files = e.target.files
|
|
resolve no if files.length < 1
|
|
let file = files[0]
|
|
let reader = new FileReader()
|
|
reader.onloadend = do
|
|
try
|
|
resolve JSON.parse(reader.result)
|
|
catch
|
|
resolve no
|
|
reader.onerror = do
|
|
resolve no
|
|
reader.readAsText(file)
|
|
|