Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
intrn(post): make post state for creation
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Oct 12, 2022
1 parent b5626b8 commit 3e141cf
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions components/post/create_post_form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,61 @@
</style>

<script setup lang="ts">
import { ref } from "vue"
import { ref, inject } from "vue"
import type { DeserializedPostAttachmentResource } from "$/types/documents/post_attachment"
import type { PageContext } from "$/types/renderer"
import type { PostResource } from "$/types/documents/post"
import type {
DeserializedPostAttachmentResource,
PostAttachmentIdentifierListDocument
} from "$/types/documents/post_attachment"
import Fetcher from "$@/fetchers/post"
import PostAttachmentFetcher from "$@/fetchers/post_attachment"
type RequiredExtraProps = "departments"
const pageContext = inject("pageContext") as PageContext<"deserialized", RequiredExtraProps>
const { pageProps } = pageContext
const { userProfile } = pageProps
const CREATE_POST_FORM_ID = "create-post"
const fetcher = new Fetcher()
const postAttachmentFetcher = new PostAttachmentFetcher()
const { isShown } = defineProps<{ isShown: boolean }>()
const roleID = ref("")
const post = ref("")
const post = ref<PostResource<"create">>({
"attributes": {
"content": "",
"deletedAt": null
},
"id": 0 as unknown as undefined,
"relationships": {
"department": {
"data": {
"id": userProfile.data.department.data.id,
"type": "department"
}
},
"postAttachments": {
"data": []
} as PostAttachmentIdentifierListDocument,
"poster": {
"data": {
"id": userProfile.data.id,
"type": "user"
}
},
"posterRole": {
"data": {
"id": userProfile.data.roles.data[0].id,
"type": "role"
}
}
},
"type": "post"
})
const attachmentResources = ref<DeserializedPostAttachmentResource[]>([])
interface CustomEvents {
Expand Down

0 comments on commit 3e141cf

Please sign in to comment.