Skip to content

Instantly share code, notes, and snippets.

View dueka's full-sized avatar

Ekanem David dueka

View GitHub Profile
// SPDX-License-Identifier: GPL-3.0
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review this code on your own before using any of
the following code for production.
*/
import { ChildDataProps, graphql } from "@apollo/react-hoc";
import { useQuery, gql } from "@apollo/client";
import ProjectsColumn from "./ProjectsColumn";
import { useState } from "react";
interface ProjectProps {
location: any;
history: any;
}
@dueka
dueka / data.ts
Last active December 5, 2021 18:02
import faker from "faker";
const rand = () => Math.floor(Math.random() * 10) + 2;
const messages = [
{
id: "1",
body: "Cursus turpis massa tincidunt dui. Non pulvinar neque laoreet suspendisse interdum consectetur libero id. Quis varius quam quisque id diam vel quam. Aenean sed adipiscing ",
},
{
id: "2",
@dueka
dueka / gist:77736662ff91c3fc868e0380bc0df723
Created August 16, 2021 17:19
This describes the transactionService and viewTransactions for paginated transactions.
export const getAllTransactions = async (params) => {
const token = selectToken;
return await axiosWithAuth(token)
.get("/treasury/transactions?include=source,beneficiary,bank", { params })
.catch(function (error) {
if (error.response.status === 401) {
logout();
}
});
import React, { useState } from "react";
import { Formik, Form } from "formik";
import * as Yup from "yup";
import InputField from "../../components/InputField";
import "./Login.scss";
import { withRouter, Link } from "react-router-dom";
import { useDispatch } from "react-redux";
import { setUser } from "../../redux/ducks/user";
import axios from "axios";
import Cookies from "js-cookie";
@dueka
dueka / gist:ad66b7ed0ad418c9047a332b23659a89
Created August 3, 2021 14:07
custom hook for retrieving investment details
export const useInvestmentDetails = (id) => {
const [currentInvestment, setCurrentInvestment] = useState([]);
const token = selectToken;
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const fetchInvestmentDetails = useCallback(() => {
const fetcInvestmentData = async () => {
const req = async () => {
try {
@dueka
dueka / gist:5488169c00aec32f9daf977da04e8e20
Created January 13, 2021 06:54
Custom react hook to fetch data from an API
export const useInvestmentTypes = () => {
const [investmentTypesData, setInvestmentTypesData] = useState([]);
const token = selectToken.data.token;
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const fetchInvestmentsTypes = useCallback(() => {
const fetchInvestmentTypesData = async () => {
const req = async () => {
try {