The Practical Framework Guide

Search

A fully-featured "Set Avatar" component

Building a fully-featured Set Avatar component in the frontend
export function promisifyXHR(xhr) {
  return new Promise((resolve, reject) => {
    xhr.addEventListener(`loadend`, (e) => {
      if(xhr.status == 200) {
        resolve(xhr)
      } else {
        reject(xhr)
      }
    })
  })
}