mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
fix(usePhoneNumber): working hook
This commit is contained in:
1 parent
d70558c7e1
commit
86f5741618
1 file changed
+8
-3
@@ -1,7 +1,12 @@
|
||||
import { pool } from './db';
|
||||
|
||||
export const usePhoneNumber = async (identifier: string) => {
|
||||
interface IPhoneNumber {
|
||||
phone_number: string;
|
||||
}
|
||||
|
||||
export async function usePhoneNumber(identifier: string): Promise<string> {
|
||||
const query = "SELECT phone_number FROM users WHERE identifier = ?"
|
||||
const phoneNumber = await pool.query(query, [identifier]);
|
||||
return phoneNumber;
|
||||
const [results] = await pool.query(query, [identifier]);
|
||||
const phoneNumber = <IPhoneNumber[]>results;
|
||||
return phoneNumber[0].phone_number;
|
||||
}
|
||||
Reference in new issue
Block a user