mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Fix read vacancy (#3039)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
cc5e7adb41
commit
a7f3dae031
@ -26,6 +26,9 @@
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import recruit from '../plugin'
|
||||
import VacancyApplications from './VacancyApplications.svelte'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import notification from '@hcengineering/notification'
|
||||
import { onDestroy } from 'svelte'
|
||||
|
||||
export let _id: Ref<Vacancy>
|
||||
export let embedded = false
|
||||
@ -33,10 +36,16 @@
|
||||
let object: Required<Vacancy>
|
||||
let rawName: string = ''
|
||||
let rawDesc: string = ''
|
||||
let lastId: Ref<Vacancy> | undefined = undefined
|
||||
|
||||
let showAllMixins = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const notificationClient = getResource(notification.function.GetNotificationClient).then((res) => res())
|
||||
|
||||
onDestroy(async () => {
|
||||
notificationClient.then((client) => client.updateLastView(_id, recruit.class.Vacancy))
|
||||
})
|
||||
|
||||
const client = getClient()
|
||||
|
||||
@ -44,11 +53,18 @@
|
||||
const clazz = client.getHierarchy().getClass(recruit.class.Vacancy)
|
||||
|
||||
function updateObject (_id: Ref<Vacancy>): void {
|
||||
query.query(recruit.class.Vacancy, { _id }, (result) => {
|
||||
object = result[0] as Required<Vacancy>
|
||||
rawName = object.name
|
||||
rawDesc = object.description
|
||||
})
|
||||
if (lastId !== _id) {
|
||||
const prev = lastId
|
||||
lastId = _id
|
||||
if (prev) {
|
||||
notificationClient.then((client) => client.updateLastView(prev, recruit.class.Vacancy))
|
||||
}
|
||||
query.query(recruit.class.Vacancy, { _id }, (result) => {
|
||||
object = result[0] as Required<Vacancy>
|
||||
rawName = object.name
|
||||
rawDesc = object.description
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$: updateObject(_id)
|
||||
|
Loading…
Reference in New Issue
Block a user