fix themes v3 not loading
This commit is contained in:
parent
9c7ff2ab61
commit
a1822a5910
3 changed files with 8 additions and 3 deletions
1
changelog.d/themes3.fix
Normal file
1
changelog.d/themes3.fix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed themes 3 not loading in appearance tab
|
||||||
|
|
@ -71,6 +71,7 @@ export const promisedRequest = async ({
|
||||||
url,
|
url,
|
||||||
payload,
|
payload,
|
||||||
formData,
|
formData,
|
||||||
|
forceContentType,
|
||||||
cache,
|
cache,
|
||||||
credentials,
|
credentials,
|
||||||
headers = {},
|
headers = {},
|
||||||
|
|
@ -79,7 +80,7 @@ export const promisedRequest = async ({
|
||||||
method,
|
method,
|
||||||
credentials: 'same-origin',
|
credentials: 'same-origin',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: forceContentType ?? 'application/json',
|
||||||
...headers,
|
...headers,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +115,7 @@ export const promisedRequest = async ({
|
||||||
)
|
)
|
||||||
if (contentLength === 0) return null
|
if (contentLength === 0) return null
|
||||||
|
|
||||||
switch (contentType) {
|
switch (forceContentType ?? contentType) {
|
||||||
case 'text/plain':
|
case 'text/plain':
|
||||||
return await response.text()
|
return await response.text()
|
||||||
case 'application/json':
|
case 'application/json':
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,9 @@ export const applyStyleConfig = (input) => {
|
||||||
adoptStyleSheets()
|
adoptStyleSheets()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getResourcesIndex = async (url, parser = (x) => x) => {
|
const noop = (x) => x
|
||||||
|
|
||||||
|
export const getResourcesIndex = async (url, parser = noop) => {
|
||||||
const cache = 'no-store'
|
const cache = 'no-store'
|
||||||
const customUrl = url.replace(/\.(\w+)$/, '.custom.$1')
|
const customUrl = url.replace(/\.(\w+)$/, '.custom.$1')
|
||||||
let builtin
|
let builtin
|
||||||
|
|
@ -324,6 +326,7 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
|
||||||
promisedRequest({
|
promisedRequest({
|
||||||
url: v,
|
url: v,
|
||||||
cache,
|
cache,
|
||||||
|
forceContentType: parser === noop ? null : 'text/plain',
|
||||||
})
|
})
|
||||||
.then(({ data: text }) => parser(text))
|
.then(({ data: text }) => parser(text))
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue