Skip to content

Commit

Permalink
feat: send job to client
Browse files Browse the repository at this point in the history
  • Loading branch information
SamShanks1 committed Aug 30, 2022
1 parent cb204d0 commit abe0cdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ RegisterNUICallback("npwd:qb-services:getPlayers", function(_, cb)
end)
end)


RegisterNUICallback("npwd:qb-services:callPlayer", function(data, cb)
-- print(data.job) job of player being called
exports.npwd:startPhoneCall(tostring(data.number))
cb({})
end)
6 changes: 3 additions & 3 deletions src/components/PlayersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const PlayersList: React.FC<PlayersListProps> = ({ players, isDarkMode })
setCollapseId(id);
};

const handleCallPlayer = (number: string) => {
fetchNui<ServerPromiseResp>('npwd:qb-services:callPlayer', { number }).then((res) => {
const handleCallPlayer = (number: string, job: string) => {
fetchNui<ServerPromiseResp>('npwd:qb-services:callPlayer', { number, job }).then((res) => {
console.log(res.data);
});
};
Expand All @@ -47,7 +47,7 @@ export const PlayersList: React.FC<PlayersListProps> = ({ players, isDarkMode })
<ListItem
secondaryAction={
<IconButton
onClick={() => handleCallPlayer(player.phoneNumber)}
onClick={() => handleCallPlayer(player.phoneNumber, player.job)}
>
<PhoneIcon />
</IconButton>
Expand Down

0 comments on commit abe0cdd

Please sign in to comment.