feat: switch to a string instead of enum
This commit is contained in:
1 parent
aeb727ae3b
commit
87612d6507
23 files changed
+92
-128
No files matched your search
@@ -6,7 +6,7 @@
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import type { Community, Person, PersonView } from 'lemmy-js-client'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import TextInput from '$lib/components/input/TextInput.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
if (date.toLocaleString('en') == 'Invalid Date') {
|
||||
toast({
|
||||
content: 'Invalid date. It must be an absolute date.',
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
loading = false
|
||||
@@ -51,7 +51,7 @@
|
||||
if (date.getTime() < Date.now()) {
|
||||
toast({
|
||||
content: 'Invalid date. It is before the current time.',
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
loading = false
|
||||
@@ -75,14 +75,14 @@
|
||||
content: `Successfully ${
|
||||
banned ? 'unbanned' : 'banned'
|
||||
} that user. You may need to refresh to see changes.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
item.banned = !banned
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import { isComment, isPost } from '$lib/lemmy/item.js'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
|
||||
export let item: PostView | CommentView
|
||||
@@ -42,12 +42,12 @@
|
||||
content: `Successfully ${
|
||||
lock ? 'locked' : 'unlocked'
|
||||
} that post. You must refresh to see changes.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@
|
||||
content: `Successfully ${
|
||||
pinned ? 'pinned' : 'unpinned'
|
||||
} that post. You must refresh to see changes.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { isComment, isPost } from '$lib/lemmy/item.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
@@ -54,12 +54,12 @@
|
||||
content: `Successfully ${
|
||||
removed ? 'restored' : 'removed'
|
||||
} that submission.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
@@ -42,10 +42,10 @@
|
||||
open = false
|
||||
toast({
|
||||
content: 'That submission has been reported.',
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({ content: err as any, type: ToastType.error })
|
||||
toast({ content: err as any, type: 'error' })
|
||||
}
|
||||
|
||||
loading = false
|
||||
|
||||
Reference in new issue
Block a user