Skip to content

Commit

Permalink
Show extra message for error
Browse files Browse the repository at this point in the history
  • Loading branch information
Zokhoi committed Sep 28, 2024
1 parent e320d50 commit 618e531
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 21 deletions.
5 changes: 5 additions & 0 deletions framerail/src/lib/popup/error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<div id="modal-message" class="modal-message">
{$showErrorPopup.message}
</div>
{#if $showErrorPopup.data}
<div id="model-message-extra" class="modal-message-extra">
{$showErrorPopup.data}
</div>
{/if}
</div>
</div>

Expand Down
3 changes: 2 additions & 1 deletion framerail/src/lib/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { useWritable } from "./use-shared-store"
export const useErrorPopup = () =>
useWritable("errorPopup", {
state: false,
message: null
message: null,
data: null,
})
9 changes: 6 additions & 3 deletions framerail/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
goto(`/${$page.params.slug}`, {
Expand All @@ -46,7 +47,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
deletedPages = res
Expand All @@ -65,7 +67,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
showRestoreAction = false
Expand Down
3 changes: 2 additions & 1 deletion framerail/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
function closeErrorPopup() {
showErrorPopup.set({
state: false,
message: null
message: null,
data: null
})
}
</script>
Expand Down
39 changes: 26 additions & 13 deletions framerail/src/routes/[slug]/[...extra]/page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else invalidateAll()
}
Expand Down Expand Up @@ -69,7 +70,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
goto(`/${$page.data.page.slug}`, {
Expand Down Expand Up @@ -97,7 +99,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
goto(`/${newSlug}`, {
Expand All @@ -119,7 +122,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
showLayoutAction = false
Expand All @@ -138,7 +142,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
parents = res.join(" ")
Expand Down Expand Up @@ -173,7 +178,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
showParentAction = false
Expand All @@ -192,7 +198,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
res.forEach((rev) => {
Expand Down Expand Up @@ -229,7 +236,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else if (!rev) {
// This is a revision we didn't even cache...?
Expand Down Expand Up @@ -258,7 +266,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else invalidateAll()
}
Expand All @@ -274,7 +283,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
voteRating = res.score ?? 0
Expand All @@ -293,7 +303,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
voteMap = new Map()
Expand All @@ -315,7 +326,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
}
}
Expand All @@ -331,7 +343,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion framerail/src/routes/[x+2d]/admin/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
isEdit = false
Expand Down
3 changes: 2 additions & 1 deletion framerail/src/routes/[x+2d]/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
} else {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion framerail/src/routes/[x+2d]/user/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
if (res?.message) {
showErrorPopup.set({
state: true,
message: res.message
message: res.message,
data: res.data
})
} else {
isEdit = false
Expand Down

0 comments on commit 618e531

Please sign in to comment.