Commit f888e3df authored by Kamal Thennakoon's avatar Kamal Thennakoon

enable dynamic portfolio generation

parent b07f65fd
import Axios from "axios";
import Axios from 'axios'
export async function getGithubInfo(username){
const url=`http://localhost:3001/api/stat/?username=${username}`;
try{
const response= await Axios.get(url);
const data=response.data;
console.log(data);
return data;
export async function getGithubInfo(username) {
const url = `http://localhost:3001/api/stat/?username=${username}`
try {
const response = await Axios.get(url)
const data = response.data
console.log(data)
return data
} catch (err) {
console.log('REST error: ', err);
return err;
}
}
}catch(err){
console.log('REST error: ',err);
export async function saveGithubInfo(userInfo) {
console.log('here we go',userInfo);
try {
const response= await Axios({
method: 'POST',
url: 'http://localhost:8000/api/user/save-git-info',
data: {
name: userInfo.summary.name,
username: userInfo.summary.name,
avatar_url: userInfo.user.avatar,
level: userInfo.summary.rank.level,
score: userInfo.summary.rank.score
}
});
console.log(response);
return response;
} catch (error) {
console.log('errrorIss',error);
return error;
}
}
\ No newline at end of file
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment