This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from 'react' | |
| import './App.css' | |
| export default function App() { | |
| const [url, setUrl] = useState("") | |
| const [shurl, setShUrl] = useState("") | |
| // https://api-ssl.bitly.com/v4/shorten | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from 'react' | |
| import './App.css' | |
| export default function App() { | |
| const [url, setUrl] = useState("") | |
| const [shurl, setShUrl] = useState("") | |
| // https://api-ssl.bitly.com/v4/shorten | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect } from 'react' | |
| import './App.css' | |
| export default function App() { | |
| const FetachData = async (uri: string): Promise<any[]> => { | |
| try { | |
| const resp = await fetch(uri) | |
| if (!resp.ok) { | |
| throw new Error(resp.statusText) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from 'axios' | |
| import { useEffect } from 'react' | |
| import './App.css' | |
| // https://jsonplaceholder.typicode.com/posts | |
| export default function App() { | |
| const FetchAPI = async (url: string): Promise<any> => { | |
| try { | |
| const response = await axios.get(url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Document, Model } from "mongoose"; | |
| import * as Mongoose from "mongoose"; | |
| const postSchema = new Mongoose.Schema({ | |
| name: { | |
| type: String, | |
| required: true, | |
| }, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function searchObjectArray(players, searchString, keys) { | |
| return players.filter(player => { | |
| return keys.some(key => { | |
| return getValueFromKey(player, key).toString().toLowerCase().includes(searchString); | |
| }); | |
| }); | |
| } | |
| function getValueFromKey(object, key) { | |
| return key.split(".").reduce((o, i) => o[i], object); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Roboto } from '@next/font/google'; | |
| import { createTheme } from '@mui/material/styles'; | |
| import { red } from '@mui/material/colors'; | |
| export const roboto = Roboto({ | |
| weight: ['300', '400', '500', '700'], | |
| subsets: ['latin'], | |
| display: 'swap', | |
| fallback: ['Helvetica', 'Arial', 'sans-serif'], | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| import '@/styles/globals.css'; | |
| import Head from 'next/head'; | |
| import { AppProps } from 'next/app'; | |
| import { ThemeProvider } from '@mui/material/styles'; | |
| import CssBaseline from '@mui/material/CssBaseline'; | |
| import { CacheProvider, EmotionCache } from '@emotion/react'; | |
| import theme from '../theme'; | |
| import createEmotionCache from '../createEmotionCache'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import createCache from '@emotion/cache'; | |
| const isBrowser = typeof document !== 'undefined'; | |
| // On the client side, Create a meta tag at the top of the <head> and set it as insertionPoint. | |
| // This assures that MUI styles are loaded first. | |
| // It allows developers to easily override MUI styles with other styling solutions, like CSS modules. | |
| export default function createEmotionCache() { | |
| let insertionPoint; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| import Document, { Html, Head, Main, NextScript } from 'next/document'; | |
| import createEmotionServer from '@emotion/server/create-instance'; | |
| import theme, { roboto } from '../theme'; | |
| import createEmotionCache from '../createEmotionCache'; | |
| export default class MyDocument extends Document { | |
| render() { | |
| return ( | |
| <Html |
NewerOlder