import { NumberFormatLocale } from './funcoes.js' export default { name: 'AccountUserInfo', data() { return { type: 'user', phone: '', // name: null, status: null, devices: [], // loading: false, } }, computed: { phone_id() { return this.type === 'user' ? `${NumberFormatLocale(this.phone)}@${window.TYPEUSER}` : `${NumberFormatLocale(this.phone)}@${window.TYPEGROUP}` } }, methods: { async openModal() { this.handleReset(); $('#modalUserInfo').modal('show'); }, async handleSubmit() { try { await this.submitApi(); showSuccessInfo("Info fetched") } catch (err) { showErrorInfo(err) } }, async submitApi() { this.loading = true; try { let response = await window.http.get(`/user/info?phone=${this.phone_id}`) this.name = response.data.results.verified_name; this.status = response.data.results.status; this.devices = response.data.results.devices; } catch (error) { if (error.response) { throw new Error(error.response.data.message); } throw new Error(error.message); } finally { this.loading = false; } }, handleReset() { this.phone = ''; this.name = null; this.status = null; this.devices = []; this.type = 'user'; } }, template: `
User Info
You can search someone user info by phone
` }