Skip to content

Instantly share code, notes, and snippets.

View Josh4324's full-sized avatar

ADESANYA JOSHUA AYODEJI Josh4324

View GitHub Profile
@Josh4324
Josh4324 / signup.js
Created November 1, 2022 02:10
signup.js
import React, { useState, useRef } from "react";
import bcrypt from "bcryptjs";
import { NotificationManager } from "react-notifications";
import Link from "next/link";
export default function Signup({ data }) {
const emailRef = useRef();
const passwordRef = useRef();
const sub = async () => {
@Josh4324
Josh4324 / files.js
Created October 31, 2022 22:21
files.js
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
if (req.method === "GET") {
// retrieving the search query
const search = req.query.search;
//filter checks for search query
const options = {
method: "POST",
headers: {
@Josh4324
Josh4324 / upload.js
Created October 31, 2022 22:16
upload.js
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
if (req.method === "POST") {
// parse incoming request
const cred = JSON.parse(req.body);
//option object, body contains media file to be uploaded on xata database
const options = {
method: "POST",
headers: {
@Josh4324
Josh4324 / login.js
Created October 31, 2022 22:05
login.js
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
if (req.method === "POST") {
// Parse incoming request body and get the email
const email = JSON.parse(req.body).email;
// option object, filter checks for email in the database
const options = {
method: "POST",
headers: {
@Josh4324
Josh4324 / signup.js
Created October 31, 2022 21:57
signup.js
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
if (req.method === "POST") {
// parse incoming request
const cred = JSON.parse(req.body);
// option object for first request, filter checks if email already exists in the database
const options1 = {
method: "POST",
@Josh4324
Josh4324 / index.js
Created October 31, 2022 21:33
index.js
import Head from "next/head";
import styles from "../styles/Home.module.css";
import Sidebar from "../components/Sidebar";
export default function Home() {
//The showWidget pops up a cloudinary widget that we can use to upload any file and it returns an object that contains
// the name, link to the url of the uploaded file and other information
const showWidget = () => {
const myWidget = window.cloudinary.createUploadWidget(
{
@Josh4324
Josh4324 / signup.js
Created October 31, 2022 13:00
signup.js
import React, { useState, useRef } from "react";
import Link from "next/link";
export default function Signup({ data }) {
return (
<div>
<div className="form">
<h2 className="white">Signup</h2>
<div>
<input className="input" placeholder="Enter Email" />
@Josh4324
Josh4324 / login.js
Created October 31, 2022 12:59
login.js
import React, { useState, useRef } from "react";
import Link from "next/link";
export default function Login() {
return (
<div>
<div className="form">
<h2 className="white">Login</h2>
<div>
<input className="input" placeholder="Enter Email" />
@Josh4324
Josh4324 / Video.js
Created October 31, 2022 12:57
Video.js
import React, { useEffect, useState } from "react";
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import Sidebar from "../components/Sidebar";
export default function Video() {
return (
<div>
<Head>
@Josh4324
Josh4324 / photos.js
Created October 31, 2022 12:50
photos.js
import React, { useEffect, useState } from "react";
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import Sidebar from "../components/Sidebar";
export default function Photos() {
return (
<div>
<Head>