Handle 403 when loading templates
This commit is contained in:
parent
c1451c6e40
commit
d07852bcf2
|
@ -1,6 +1,7 @@
|
||||||
import { store } from "./index"
|
import { store } from "./index"
|
||||||
import { get as svelteGet } from "svelte/store"
|
import { get as svelteGet } from "svelte/store"
|
||||||
import { removeCookie, Cookies } from "./cookies"
|
import { removeCookie, Cookies } from "./cookies"
|
||||||
|
import { notifications } from "@budibase/bbui"
|
||||||
|
|
||||||
const apiCall =
|
const apiCall =
|
||||||
method =>
|
method =>
|
||||||
|
@ -13,6 +14,12 @@ const apiCall =
|
||||||
headers,
|
headers,
|
||||||
})
|
})
|
||||||
if (resp.status === 403) {
|
if (resp.status === 403) {
|
||||||
|
if (url.includes("/api/templates")) {
|
||||||
|
notifications.error(
|
||||||
|
"There was a problem loading quick start templates."
|
||||||
|
)
|
||||||
|
return { json: () => [] }
|
||||||
|
}
|
||||||
removeCookie(Cookies.Auth)
|
removeCookie(Cookies.Auth)
|
||||||
// reload after removing cookie, go to login
|
// reload after removing cookie, go to login
|
||||||
if (!url.includes("self") && !url.includes("login")) {
|
if (!url.includes("self") && !url.includes("login")) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ module S3Module {
|
||||||
signatureVersion: {
|
signatureVersion: {
|
||||||
type: "string",
|
type: "string",
|
||||||
required: false,
|
required: false,
|
||||||
default: "v4"
|
default: "v4",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
|
|
Loading…
Reference in New Issue