fixes/cleanup

This commit is contained in:
f0x 2023-01-17 20:59:40 +00:00
parent 772231d24e
commit 2362c0627f
4 changed files with 20 additions and 20 deletions

View File

@ -14,7 +14,6 @@
"@reduxjs/toolkit": "^1.8.6", "@reduxjs/toolkit": "^1.8.6",
"ariakit": "^2.0.0-next.41", "ariakit": "^2.0.0-next.41",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
"dotty": "^0.1.2",
"is-valid-domain": "^0.1.6", "is-valid-domain": "^0.1.6",
"js-file-download": "^0.4.12", "js-file-download": "^0.4.12",
"langs": "^2.0.0", "langs": "^2.0.0",

View File

@ -19,8 +19,25 @@
"use strict"; "use strict";
const { createApi, fetchBaseQuery } = require("@reduxjs/toolkit/query/react"); const { createApi, fetchBaseQuery } = require("@reduxjs/toolkit/query/react");
const { isPlainObject } = require("is-plain-object");
const { convertToForm } = require("../api"); function convertToForm(obj) {
const formData = new FormData();
Object.entries(obj).forEach(([key, val]) => {
if (isPlainObject(val)) {
Object.entries(val).forEach(([key2, val2]) => {
if (val2 != undefined) {
formData.set(`${key}[${key2}]`, val2);
}
});
} else {
if (val != undefined) {
formData.set(key, val);
}
}
});
return formData;
}
function instanceBasedQuery(args, api, extraOptions) { function instanceBasedQuery(args, api, extraOptions) {
const state = api.getState(); const state = api.getState();
@ -51,17 +68,7 @@ function instanceBasedQuery(args, api, extraOptions) {
headers.set("Accept", "application/json"); headers.set("Accept", "application/json");
return headers; return headers;
}, },
})(args, api, extraOptions).then((res) => { })(args, api, extraOptions);
if (res.error != undefined) {
const { error } = res;
// if (error.status == 401 || error.status == 403) {
// }
return res;
} else {
return res;
}
});
} }
module.exports = createApi({ module.exports = createApi({

View File

@ -19,7 +19,6 @@
"use strict"; "use strict";
const React = require("react"); const React = require("react");
const Redux = require("react-redux");
const query = require("../lib/query"); const query = require("../lib/query");
@ -64,7 +63,7 @@ function UserProfileForm({ data: profile }) {
- string custom_css (if enabled) - string custom_css (if enabled)
*/ */
const { data: instance, isLoading: isLoadingInstance } = query.useInstanceQuery(); const { data: instance } = query.useInstanceQuery();
const allowCustomCSS = React.useMemo(() => { const allowCustomCSS = React.useMemo(() => {
return instance?.configuration?.accounts?.allow_custom_css === true; return instance?.configuration?.accounts?.allow_custom_css === true;
}, [instance]); }, [instance]);

View File

@ -2463,11 +2463,6 @@ domain-browser@^1.2.0:
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==
dotty@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/dotty/-/dotty-0.1.2.tgz#512d44cc4111a724931226259297f235e8484f6f"
integrity sha512-V0EWmKeH3DEhMwAZ+8ZB2Ao4OK6p++Z0hsDtZq3N0+0ZMVqkzrcEGROvOnZpLnvBg5PTNG23JEDLAm64gPaotQ==
duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2, duplexer2@~0.1.4: duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2, duplexer2@~0.1.4:
version "0.1.4" version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1"