+
+
DevSphere
@@ -20,9 +23,13 @@ const Navbar = () => {
-
{/* TODO: Add the home route here */}
+
+ Home
+
-
{/* TODO: Add the projects route here */}
+ Projects
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
index aaac8db..95c1cd2 100644
--- a/src/pages/Home.jsx
+++ b/src/pages/Home.jsx
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
// TODO: Import axios here
+import axios from 'axios';
import moment from 'moment';
import { Users, Star, GitBranch, MapPin, Calendar, ExternalLink } from 'lucide-react';
@@ -14,6 +15,33 @@ const Home = () => {
// TODO: Fetch user data from GitHub API using axios and useEffect and set the user state, also handle the loading and error states
// API: https://api.github.com/users/YOUR_USERNAME
+
+
+ useEffect (() =>{
+ const fetchApi = async () => {
+
+ try {
+ setLoading(true)
+ axios
+ .get("https://api.github.com/users/AbdiqadirAbdikrin")
+ .then((response) => {
+ setUser(response.data);
+ setLoading(false)
+
+ })
+
+ }catch (error) {
+ console.log(error);
+ setLoading(false);
+ }
+
+
+ }
+ fetchApi()
+
+
+ },[]);
+
diff --git a/src/pages/Projects.jsx b/src/pages/Projects.jsx
index def4d8a..29350ab 100644
--- a/src/pages/Projects.jsx
+++ b/src/pages/Projects.jsx
@@ -5,6 +5,7 @@ import React, { useState, useEffect } from 'react';
import ProjectCard from '../components/ProjectCard';
import '../styles/Projects.css';
+import axios from 'axios';
const Projects = () => {
const [repos, setRepos] = useState([]);
@@ -15,6 +16,34 @@ const Projects = () => {
// API: https://api.github.com/users/YOUR_GITHUB_USERNAME/repos?per_page=10&sort=updated
+ useEffect(() =>{
+
+ const FetchApiRepo = async () => {
+
+ try{
+ axios
+ .get("https://api.github.com/users/AbdiqadirAbdikrin/repos?per_page=10&sort=updated")
+ .then((response) =>{
+ setRepos(response.data)
+ setLoading(false)
+ })
+
+
+ }catch(error) {
+ console.log(error)
+ setLoading(false)
+ }
+
+
+
+ }
+
+ FetchApiRepo ()
+
+
+ },[])
+
+
if (loading) {
return Loading repositories...
;