chore(deps): remove jquery as deps

This commit is contained in:
Brice Maron 2022-09-03 20:53:06 +02:00
parent 2a971cf253
commit 39769428d0
4 changed files with 16 additions and 36 deletions

View file

@ -1,4 +1,3 @@
import $ from "jquery"
import ImageProvider, { ProvidedImage } from "./ImageProvider";
import BaseUIElement from "../../UI/BaseUIElement";
import {Utils} from "../../Utils";
@ -51,33 +50,27 @@ export class Imgur extends ImageProvider {
const apiUrl = 'https://api.imgur.com/3/image';
const apiKey = Constants.ImgurApiKey;
const settings = {
async: true,
crossDomain: true,
processData: false,
contentType: false,
type: 'POST',
url: apiUrl,
headers: {
Authorization: 'Client-ID ' + apiKey,
Accept: 'application/json',
},
mimeType: 'multipart/form-data',
};
const formData = new FormData();
formData.append('image', blob);
formData.append("title", title);
formData.append("description", description)
// @ts-ignore
settings.data = formData;
const settings: RequestInit = {
method: 'POST',
body: formData,
redirect: 'follow',
headers: new Headers({
Authorization: `Client-ID ${apiKey}`,
Accept: 'application/json',
}),
};
// Response contains stringified JSON
// Image URL available at response.data.link
// @ts-ignore
$.ajax(settings).done(async function (response) {
response = JSON.parse(response);
await handleSuccessfullUpload(response.data.link);
}).fail((reason) => {
fetch(apiUrl, settings).then(async function (response) {
const content = await response.json()
await handleSuccessfullUpload(content.data.link);
}).catch((reason) => {
console.log("Uploading to IMGUR failed", reason);
// @ts-ignore
onFail(reason);

View file

@ -12,7 +12,6 @@ import {Changes} from "../Osm/Changes";
import ChangeToElementsActor from "../Actors/ChangeToElementsActor";
import PendingChangesUploader from "../Actors/PendingChangesUploader";
import * as translators from "../../assets/translators.json"
import {post} from "jquery";
import Maproulette from "../Maproulette";
/**

11
package-lock.json generated
View file

@ -38,7 +38,6 @@
"geojson2svg": "^1.3.1",
"i18next-client": "^1.11.4",
"idb-keyval": "^6.0.3",
"jquery": "^3.6.0",
"jspdf": "^2.3.1",
"latlon2country": "^1.2.6",
"leaflet": "^1.7.1",
@ -8732,11 +8731,6 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"node_modules/jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -23596,11 +23590,6 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

View file

@ -97,7 +97,6 @@
"geojson2svg": "^1.3.1",
"i18next-client": "^1.11.4",
"idb-keyval": "^6.0.3",
"jquery": "^3.6.0",
"jspdf": "^2.3.1",
"latlon2country": "^1.2.6",
"leaflet": "^1.7.1",