Skip to content

Commit

Permalink
fix(server): return missing locale string
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Aug 2, 2024
1 parent 3dd8533 commit 9b43100
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ onClientCallback(

const success = await oxmysql.prepare('SELECT 1 FROM `characters` WHERE `stateId` = ?', [stateId]);

// todo locale
if (!success) return 'No person with provided state id found.';
if (!success) return 'state_id_not_exists';

return await Ox.SetAccountAccess(accountId, stateId, role);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const NewAccountUserModal: React.FC<{ accountId: number }> = ({ accountId }) =>
async function onSubmit(values: z.infer<typeof formSchema>) {
setIsLoading(true);

const resp = await fetchNui<true | string>(
const resp = await fetchNui<true | keyof typeof locales>(
'addUserToAccount',
{ accountId, ...values },
{
Expand All @@ -46,7 +46,7 @@ const NewAccountUserModal: React.FC<{ accountId: number }> = ({ accountId }) =>

if (typeof resp === 'string') {
setIsLoading(false);
form.setError('stateId', { type: 'value', message: resp });
form.setError('stateId', { type: 'value', message: locales[resp] });

return;
}
Expand Down

0 comments on commit 9b43100

Please sign in to comment.