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
<script setup lang="ts"></script> | |
<template> | |
<h1>admin layout</h1> | |
<router-view></router-view> | |
</template> |
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 React from 'react' | |
function ArrowIcon() { | |
return ( | |
<svg | |
width="7" | |
height="12" | |
viewBox="0 0 7 12" | |
fill="none" | |
xmlns="http://www.w3.org/2000/svg" |
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
<script setup lang="ts"> | |
import { Form, Field, ErrorMessage } from 'vee-validate' | |
import * as yup from 'yup' | |
const schema = yup.object().shape({ | |
email: yup | |
.string() | |
.email('Email tidak valid') | |
.required((data) => `${data.path} harus diisi`), | |
password: yup |
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 '../styles/globals.css' | |
import type { AppProps } from 'next/app' | |
import type { NextPage } from 'next' | |
import type { ReactElement, ReactNode } from 'react' | |
export type NextPageWithLayout = NextPage & { | |
getLayout?: (page: ReactElement) => ReactNode | |
} | |
type AppPropsWithLayout = AppProps & { |
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 { NextResponse } from 'next/server' | |
import type { NextRequest } from 'next/server' | |
export function middleware(req: NextRequest) { | |
// get cookie token | |
const hasToken = req.cookies.get('token') | |
// protected routes (admin routes) | |
if (req.nextUrl.pathname.startsWith('/admin')) { | |
if (hasToken) { |
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
const { useState } = React; | |
function PageComponent() { | |
const [count, setCount] = useState(0); | |
const increment = () => { | |
setCount(count + 1) | |
} | |
return ( | |
<div className="App"> |
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
items.sort(function(a, b) { | |
return a.id - b.id || a.name.localeCompare(b.name); | |
}); |
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 React from 'react' | |
import { Outlet } from 'react-router-dom' | |
export default function App() { | |
return <Outlet /> | |
} |
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 React, { useState } from 'react' | |
import { | |
useGetPokemonByIdQuery, | |
useGetPokemonByNameQuery, | |
} from './services/pokemon' | |
function App() { | |
const [id, setId] = useState<number>(5) | |
const [name, setName] = useState<string>('bulbasaur') |
NewerOlder