uodate
This commit is contained in:
+39
-17
@@ -1,24 +1,46 @@
|
||||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import React, { useEffect, useState } from "react";
|
||||
import "./App.css";
|
||||
import Client from "mtproton/envs/browser";
|
||||
|
||||
function App() {
|
||||
let [countriesList, setcountriesList] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
let client = new Client({
|
||||
api_id: 18987971,
|
||||
api_hash: "fcfd9e6ed3f9e48a360bb57cc0d59d98",
|
||||
});
|
||||
client.call("help.getCountriesList").then((result: any) => {
|
||||
console.log("country:", result);
|
||||
result.countries.map((country: any) => {
|
||||
// @ts-ignore
|
||||
setcountriesList((oldArray) => [
|
||||
...oldArray,
|
||||
country.default_name + ": " + country.country_codes[0].country_code,
|
||||
]);
|
||||
return true;
|
||||
});
|
||||
});
|
||||
}, []);
|
||||
|
||||
// client
|
||||
// .invoke({
|
||||
// _: "getCountryCode",
|
||||
// })
|
||||
// .then((res) => {
|
||||
// console.log(res);
|
||||
// });
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
{countriesList.map((country: any, index) => {
|
||||
return (
|
||||
<div key={index}>
|
||||
{country}
|
||||
<br />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
declare module "mtproton/envs/browser";
|
||||
Reference in New Issue
Block a user