mirror of
https://github.com/kac5a/k5_documents.git
synced 2026-08-03 11:18:37 -04:00
Add QBCore support
This commit is contained in:
@@ -1,31 +1,57 @@
|
||||
ESX = nil
|
||||
|
||||
local selectingPlayer = false
|
||||
local prop = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
local TriggerCallback
|
||||
local Notification
|
||||
|
||||
local QBCore
|
||||
ESX = nil
|
||||
|
||||
if Config.Framework == "esx" then
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
while ESX.GetPlayerData().job == nil do
|
||||
Citizen.Wait(10)
|
||||
end
|
||||
|
||||
ESX.PlayerData = ESX.GetPlayerData()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
ESX.PlayerData = xPlayer
|
||||
ESX.PlayerLoaded = true
|
||||
end)
|
||||
|
||||
TriggerCallback = function (name, cb, ...)
|
||||
ESX.TriggerServerCallback(name, cb, ...)
|
||||
end
|
||||
|
||||
while ESX.GetPlayerData().job == nil do
|
||||
Citizen.Wait(10)
|
||||
end
|
||||
Notification = function (msg)
|
||||
ESX.ShowNotification(msg)
|
||||
end
|
||||
|
||||
ESX.PlayerData = ESX.GetPlayerData()
|
||||
end)
|
||||
elseif Config.Framework == "qb" then
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
TriggerCallback = function (name, cb, ...)
|
||||
QBCore.Functions.TriggerCallback(name, cb, ...)
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
ESX.PlayerData = xPlayer
|
||||
ESX.PlayerLoaded = true
|
||||
end)
|
||||
Notification = function (msg)
|
||||
QBCore.Functions.Notify(msg)
|
||||
end
|
||||
else
|
||||
print("^8ERROR: ^3Unsupported or misspelled framework^7")
|
||||
end
|
||||
|
||||
function holdDocument(shouldHold)
|
||||
if shouldHold then
|
||||
@@ -84,82 +110,104 @@ end
|
||||
|
||||
RegisterNUICallback('hideDocument', function(_, cb)
|
||||
toggleDocumentFrame(false, nil)
|
||||
debugPrint('Hide NUI frame')
|
||||
cb({})
|
||||
end)
|
||||
|
||||
RegisterCommand(Config.Command, function()
|
||||
toggleNuiFrame(true, true)
|
||||
debugPrint('Show NUI frame')
|
||||
end)
|
||||
|
||||
RegisterNUICallback('hideFrame', function(_, cb)
|
||||
toggleNuiFrame(false, false)
|
||||
debugPrint('Hide NUI frame')
|
||||
cb({})
|
||||
end)
|
||||
|
||||
RegisterNUICallback('getPlayerJob', function(data, cb)
|
||||
debugPrint('Data sent by React', json.encode(data))
|
||||
local retData <const> = ESX.PlayerData.job
|
||||
cb(retData)
|
||||
if Config.Framework == "esx" then
|
||||
local retData <const> = ESX.PlayerData.job
|
||||
retData.isBoss = retData.grade_name == "boss"
|
||||
cb(retData)
|
||||
elseif Config.Framework == "qb" then
|
||||
local PlayerJob = QBCore.Functions.GetPlayerData().job
|
||||
local retData = {
|
||||
grade = PlayerJob.grade.level,
|
||||
grade_label = PlayerJob.grade.name,
|
||||
grade_name = PlayerJob.grade.name,
|
||||
grade_salary = PlayerJob.payment,
|
||||
label = PlayerJob.label,
|
||||
name = PlayerJob.name,
|
||||
skin_female = {},
|
||||
skin_male = {},
|
||||
}
|
||||
retData.isBoss = PlayerJob.isboss
|
||||
cb(retData)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNUICallback('getPlayerData', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:getPlayerData', function(result)
|
||||
cb(result)
|
||||
end)
|
||||
if Config.Framework == "esx" then
|
||||
ESX.TriggerServerCallback('k5_documents:getPlayerData', function(result)
|
||||
cb(result)
|
||||
end)
|
||||
elseif Config.Framework == "qb" then
|
||||
local PlayerData = QBCore.Functions.GetPlayerData().charinfo
|
||||
cb({
|
||||
firstname = PlayerData.firstname,
|
||||
lastname = PlayerData.lastname,
|
||||
dateofbirth = PlayerData.birthdate,
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNUICallback('getPlayerCopies', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:getPlayerCopies', function(result)
|
||||
TriggerCallback('k5_documents:getPlayerCopies', function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('getIssuedDocuments', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:getPlayerDocuments', function(result)
|
||||
TriggerCallback('k5_documents:getPlayerDocuments', function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('createDocument', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:createDocument',function(result)
|
||||
TriggerCallback('k5_documents:createDocument',function(result)
|
||||
cb(result)
|
||||
end,
|
||||
data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('createTemplate', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:createTemplate',function(result)
|
||||
TriggerCallback('k5_documents:createTemplate',function(result)
|
||||
cb(result)
|
||||
end,
|
||||
data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('editTemplate', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:editTemplate',function(result)
|
||||
TriggerCallback('k5_documents:editTemplate',function(result)
|
||||
cb(result)
|
||||
end,
|
||||
data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('deleteTemplate', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:deleteTemplate',function(result)
|
||||
TriggerCallback('k5_documents:deleteTemplate',function(result)
|
||||
cb(result)
|
||||
end,
|
||||
data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('deleteDocument', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:deleteDocument',function(result)
|
||||
TriggerCallback('k5_documents:deleteDocument',function(result)
|
||||
cb(result)
|
||||
end,
|
||||
data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('getMyTemplates', function(data, cb)
|
||||
ESX.TriggerServerCallback('k5_documents:getDocumentTemplates', function(result)
|
||||
TriggerCallback('k5_documents:getDocumentTemplates', function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
@@ -192,13 +240,13 @@ RegisterNetEvent('k5_documents:copyGave')
|
||||
AddEventHandler('k5_documents:copyGave', function(data)
|
||||
holdDocument(false)
|
||||
playAnim("mp_common", "givetake1_a", 1500)
|
||||
ESX.ShowNotification(Config.Locale.giveNotification .. " ~b~" .. data)
|
||||
Notification(Config.Locale.giveNotification .. " " .. data)
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('k5_documents:copyReceived')
|
||||
AddEventHandler('k5_documents:copyReceived', function(data)
|
||||
ESX.ShowNotification(Config.Locale.receiveNotification .. " ~b~" .. data)
|
||||
Notification(Config.Locale.receiveNotification .. " " .. data)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('k5_documents:viewDocument')
|
||||
@@ -211,7 +259,12 @@ function playerSelector(confirmText)
|
||||
selectingPlayer = true
|
||||
|
||||
while selectingPlayer do
|
||||
local closestPlayer, closestPlayerDistance = ESX.Game.GetClosestPlayer()
|
||||
local closestPlayer, closestPlayerDistance
|
||||
if Config.Framework == "esx" then
|
||||
closestPlayer, closestPlayerDistance = ESX.Game.GetClosestPlayer()
|
||||
elseif Config.Framework == "qb" then
|
||||
closestPlayer, closestPlayerDistance = QBCore.Functions.GetClosestPlayer()
|
||||
end
|
||||
local closestPlayerCoords = GetEntityCoords(GetPlayerPed(closestPlayer))
|
||||
|
||||
DisableControlAction(2, 200, true)
|
||||
@@ -235,7 +288,7 @@ function playerSelector(confirmText)
|
||||
end
|
||||
else
|
||||
if IsControlJustReleased(0, 38) then
|
||||
ESX.ShowNotification(Config.Locale.noPlayersAround)
|
||||
Notification(Config.Locale.noPlayersAround)
|
||||
end
|
||||
end
|
||||
Citizen.Wait(1)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
Config = {}
|
||||
|
||||
Config.Framework = "esx" -- "esx" or "qb"
|
||||
|
||||
Config.Command = "documents"
|
||||
|
||||
-- These texts only show up on client side. To change texts in the NUI,
|
||||
|
||||
@@ -1,31 +1,49 @@
|
||||
local RegisterCallback
|
||||
ESX = nil
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
local QBCore
|
||||
if Config.Framework == "esx" then
|
||||
ESX = nil
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
RegisterCallback = function (name, fn)
|
||||
ESX.RegisterServerCallback(name, fn)
|
||||
end
|
||||
elseif Config.Framework == "qb" then
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterCallback = function (name, fn)
|
||||
QBCore.Functions.CreateCallback(name, fn)
|
||||
end
|
||||
else
|
||||
print("^8ERROR: ^3Unsupported or misspelled framework^7")
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:getPlayerCopies', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT id, data, isCopy FROM k5_documents WHERE ownerId = @identifier and isCopy = "1"', {
|
||||
['@identifier'] = xPlayer.identifier
|
||||
}, function(result)
|
||||
local mappedResult = {}
|
||||
for k, v in pairs(result) do
|
||||
local thisData = json.decode(v.data)
|
||||
thisData.id = v.id
|
||||
thisData.isCopy = v.isCopy
|
||||
table.insert(mappedResult, thisData)
|
||||
end
|
||||
cb(mappedResult)
|
||||
end)
|
||||
RegisterCallback('k5_documents:getPlayerCopies', function(source, cb)
|
||||
local src = source
|
||||
local PlayerIdentifier = GetPlayerIdentifier(src)
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT id, data, isCopy FROM k5_documents WHERE ownerId = @identifier and isCopy = "1"', {
|
||||
['@identifier'] = PlayerIdentifier
|
||||
}, function(result)
|
||||
local mappedResult = {}
|
||||
for k, v in pairs(result) do
|
||||
local thisData = json.decode(v.data)
|
||||
thisData.id = v.id
|
||||
thisData.isCopy = v.isCopy
|
||||
table.insert(mappedResult, thisData)
|
||||
end
|
||||
cb(mappedResult)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:getPlayerDocuments', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
RegisterCallback('k5_documents:getPlayerDocuments', function(source, cb)
|
||||
local src = source
|
||||
local PlayerIdentifier = GetPlayerIdentifier(src)
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT id, data, isCopy FROM k5_documents WHERE ownerId = @identifier and isCopy = "0"', {
|
||||
['@identifier'] = xPlayer.identifier
|
||||
['@identifier'] = PlayerIdentifier
|
||||
}, function(result)
|
||||
local mappedResult = {}
|
||||
for k, v in pairs(result) do
|
||||
@@ -38,36 +56,37 @@ ESX.RegisterServerCallback('k5_documents:getPlayerDocuments', function(source, c
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:getDocumentTemplates', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
RegisterCallback('k5_documents:getDocumentTemplates', function(source, cb)
|
||||
local src = source
|
||||
local PlayerJobName = GetPlayerJobName(src)
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT id, data FROM k5_document_templates WHERE job = @job', {
|
||||
['@job'] = xPlayer.job.name
|
||||
}, function(result)
|
||||
local mappedResult = {}
|
||||
for k, v in pairs(result) do
|
||||
local thisData = json.decode(v.data)
|
||||
thisData.id = v.id
|
||||
table.insert(mappedResult, thisData)
|
||||
end
|
||||
cb(mappedResult)
|
||||
end)
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT id, data FROM k5_document_templates WHERE job = @job', {
|
||||
['@job'] = PlayerJobName
|
||||
}, function(result)
|
||||
local mappedResult = {}
|
||||
for k, v in pairs(result) do
|
||||
local thisData = json.decode(v.data)
|
||||
thisData.id = v.id
|
||||
table.insert(mappedResult, thisData)
|
||||
end
|
||||
cb(mappedResult)
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:createTemplate', function(source, cb, data)
|
||||
local src = source
|
||||
local xPlayer = ESX.GetPlayerFromId(src)
|
||||
RegisterCallback('k5_documents:createTemplate', function(source, cb, data)
|
||||
local src = source
|
||||
local PlayerJobName = GetPlayerJobName(src)
|
||||
|
||||
MySQL.Async.insert('INSERT INTO k5_document_templates (data, job) VALUES (@data, @job)', {
|
||||
['@data'] = data,
|
||||
['@job'] = xPlayer.job.name
|
||||
['@job'] = PlayerJobName
|
||||
}, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:editTemplate', function(source, cb, data)
|
||||
RegisterCallback('k5_documents:editTemplate', function(source, cb, data)
|
||||
local obj = json.decode(data)
|
||||
|
||||
MySQL.Async.execute('UPDATE k5_document_templates SET data = @data WHERE id = @id', {
|
||||
@@ -75,43 +94,44 @@ ESX.RegisterServerCallback('k5_documents:editTemplate', function(source, cb, dat
|
||||
['@id'] = obj.id
|
||||
}, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:deleteTemplate', function(source, cb, data)
|
||||
RegisterCallback('k5_documents:deleteTemplate', function(source, cb, data)
|
||||
MySQL.Async.execute('DELETE FROM k5_document_templates WHERE id = @id', {
|
||||
['@id'] = data
|
||||
}, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:getPlayerData', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT firstname, lastname, dateofbirth FROM users WHERE identifier = @identifier', {
|
||||
['@identifier'] =xPlayer.identifier
|
||||
}, function(result)
|
||||
cb(result[1])
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:createDocument', function(source, cb, data)
|
||||
RegisterCallback('k5_documents:getPlayerData', function(source, cb)
|
||||
local src = source
|
||||
local xPlayer = ESX.GetPlayerFromId(src)
|
||||
local PlayerIdentifier = GetPlayerIdentifier(src)
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT firstname, lastname, dateofbirth FROM users WHERE identifier = @identifier', {
|
||||
['@identifier'] = PlayerIdentifier
|
||||
}, function(result)
|
||||
cb(result[1])
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterCallback('k5_documents:createDocument', function(source, cb, data)
|
||||
local src = source
|
||||
local PlayerIdentifier = GetPlayerIdentifier(src)
|
||||
|
||||
MySQL.Async.insert('INSERT INTO k5_documents (data, ownerId, isCopy) VALUES (@data, @ownerId, @isCopy)', {
|
||||
['@data'] = data,
|
||||
['@ownerId'] = xPlayer.identifier,
|
||||
['@ownerId'] = PlayerIdentifier,
|
||||
['@isCopy'] = json.decode(data).isCopy
|
||||
}, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('k5_documents:deleteDocument', function(source, cb, data)
|
||||
RegisterCallback('k5_documents:deleteDocument', function(source, cb, data)
|
||||
MySQL.Async.execute('DELETE FROM k5_documents WHERE id = @id', {
|
||||
['@id'] = data
|
||||
}, function(result)
|
||||
@@ -122,14 +142,13 @@ end)
|
||||
RegisterServerEvent('k5_documents:giveCopy')
|
||||
AddEventHandler('k5_documents:giveCopy', function(data, targetId)
|
||||
local src = source
|
||||
local xPlayer = ESX.GetPlayerFromId(src)
|
||||
|
||||
local tsrc = targetId
|
||||
local tPlayer = ESX.GetPlayerFromId(tsrc)
|
||||
|
||||
local TPlayerIdentifier = GetPlayerIdentifier(tsrc)
|
||||
|
||||
MySQL.Async.insert('INSERT INTO k5_documents (data, ownerId, isCopy) VALUES (@data, @ownerId, @isCopy)', {
|
||||
['@data'] = json.encode(data),
|
||||
['@ownerId'] = tPlayer.identifier,
|
||||
['@ownerId'] = TPlayerIdentifier,
|
||||
['@isCopy'] = true
|
||||
}, function(result)
|
||||
TriggerClientEvent("k5_documents:copyGave", src, data.name)
|
||||
@@ -141,12 +160,30 @@ end)
|
||||
RegisterServerEvent("k5_documents:receiveDocument")
|
||||
AddEventHandler("k5_documents:receiveDocument", function(data, targetId)
|
||||
local tsrc = targetId
|
||||
local tPlayer = ESX.GetPlayerFromId(tsrc)
|
||||
|
||||
MySQL.Async.fetchAll('SELECT data FROM k5_documents WHERE id = @docId', {
|
||||
['@docId'] = data.docId,
|
||||
}, function(result)
|
||||
TriggerClientEvent("k5_documents:viewDocument", tsrc, result[1])
|
||||
end)
|
||||
end)
|
||||
|
||||
end)
|
||||
function GetPlayerIdentifier(src)
|
||||
local PlayerIdentifier
|
||||
if Config.Framework == "esx" then
|
||||
PlayerIdentifier = ESX.GetPlayerFromId(src).identifier
|
||||
elseif Config.Framework == "qb" then
|
||||
PlayerIdentifier = QBCore.Functions.GetPlayer(src).PlayerData.citizenid
|
||||
end
|
||||
return PlayerIdentifier
|
||||
end
|
||||
|
||||
function GetPlayerJobName(src)
|
||||
local PlayerJobName
|
||||
if Config.Framework == "esx" then
|
||||
PlayerJobName = ESX.GetPlayerFromId(src).job.name
|
||||
elseif Config.Framework == "qb" then
|
||||
PlayerJobName = QBCore.Functions.GetPlayer(src).PlayerData.job.name
|
||||
end
|
||||
return PlayerJobName
|
||||
end
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/web/build/static/js/main.2d831c67.js",
|
||||
"main.js": "/web/build/static/js/main.c88d6ca3.js",
|
||||
"static/media/city_logo.png": "/web/build/static/media/city_logo.008b591a2d4e6445d96c.png",
|
||||
"index.html": "/web/build/index.html",
|
||||
"main.2d831c67.js.map": "/web/build/static/js/main.2d831c67.js.map"
|
||||
"main.c88d6ca3.js.map": "/web/build/static/js/main.c88d6ca3.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/main.2d831c67.js"
|
||||
"static/js/main.c88d6ca3.js"
|
||||
]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Oooh+Baby&display=swap" rel="stylesheet"/><title>K5 Documents</title><script type="text/javascript" src="/web/build/config.js"></script><script defer="defer" src="/web/build/static/js/main.2d831c67.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Oooh+Baby&display=swap" rel="stylesheet"/><title>K5 Documents</title><script type="text/javascript" src="/web/build/config.js"></script><script defer="defer" src="/web/build/static/js/main.c88d6ca3.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
web/build/static/js/main.c88d6ca3.js.map
Normal file
1
web/build/static/js/main.c88d6ca3.js.map
Normal file
File diff suppressed because one or more lines are too long
1
web/src/components/types.d.ts
vendored
1
web/src/components/types.d.ts
vendored
@@ -14,6 +14,7 @@ declare type Job = {
|
||||
grade_salary: number
|
||||
label: string
|
||||
name: string
|
||||
isBoss: boolean
|
||||
skin_female: Array<any>
|
||||
skin_male: Array<any>
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export const useJob = () => {
|
||||
},[job])
|
||||
|
||||
const isBoss = useMemo(() => {
|
||||
return job?.grade_name === 'boss' ?? false
|
||||
return job?.isBoss || false
|
||||
},[job])
|
||||
|
||||
const getPlayerJobData = async () => {
|
||||
|
||||
Reference in New Issue
Block a user