Skip to content

Instantly share code, notes, and snippets.

Avatar

Kouji Nakashima kuc-arc-f

View GitHub Profile
@kuc-arc-f
kuc-arc-f / index-head-sample.js
Created Mar 1, 2021
Gatsby.js API Fetch + HeadlessCMS, sample
View index-head-sample.js
// Gatsby.js API Fetch + HeadlessCMS, sample
import React, { useState, useEffect } from "react"
const IndexPage = () => {
const [postItems, setPostItems] = useState([])
const site_id = "123"
const base_url = "http://hoge.com"
var url = base_url+`/api/get/find?content=posts&site_id=${site_id}`
useEffect( ()=>{
@kuc-arc-f
kuc-arc-f / index.js
Created Mar 1, 2021
Gatsby.js API Fetch, sample
View index.js
// Gatsby.js API Fetch, sample
// https://www.gatsbyjs.com/docs/data-fetching/#retrieving-data-with-the-fetch-api
import React, { useState, useEffect } from "react"
// import { graphql, useStaticQuery } from "gatsby"
const IndexPage = () => {
// Client-side Runtime Data Fetching
const [starsCount, setStarsCount] = useState(0)
useEffect(() => {
@kuc-arc-f
kuc-arc-f / gh-pages.yml
Last active Mar 1, 2021
Github Action ,schedule set test gh-pages.yml
View gh-pages.yml
name: github pages
on:
schedule:
- cron: '0 0 * * *'
jobs:
build-deploy:
runs-on: ubuntu-18.04
env:
@kuc-arc-f
kuc-arc-f / gh-pages.yml
Created Feb 26, 2021
Github action , SSG コンパイル gh-pages.yml
View gh-pages.yml
name: github pages
on:
push:
branches:
- main
jobs:
build-deploy:
runs-on: ubuntu-18.04
@kuc-arc-f
kuc-arc-f / test.js
Created Jan 25, 2021
strapi ,Related data sample
View test.js
// strapi ,Related data sample
import React from 'react'
import Layout from '../components/layout'
import LibCommon from '../libs/LibCommon'
import LibPagenate from '../libs/LibPagenate'
import TopHeadBox from '../components/TopHeadBox'
import IndexRow from './IndexRow';
//
@kuc-arc-f
kuc-arc-f / .babelrc
Last active Jan 23, 2021
axios, strapi post sample
View .babelrc
{
"presets": [
"@babel/preset-env"
]
}
@kuc-arc-f
kuc-arc-f / auth_check.js
Created Jan 15, 2021
Next.js, Login auth sample
View auth_check.js
const bcrypt = require('bcrypt');
var AUTH_MAIL = "hoge@example.com"
var AUTH_PASSWORD="1111"
//
export default async (req, res) => {
try{
if (req.method === "POST") {
var data = req.body
console.log(data)
@kuc-arc-f
kuc-arc-f / test_login.js
Created Jan 15, 2021
Next.js, Login sample
View test_login.js
// Next.js, Login sample
import Layout from '../components/layout'
import React from 'react'
import cookies from 'next-cookies'
class Page extends React.Component {
static async getInitialProps(ctx) {
return {
initialName: ''
@kuc-arc-f
kuc-arc-f / test.js
Created Jan 14, 2021
Next.js, flash get sample
View test.js
// Next.js, flash get sample
import flash from 'next-flash';
import Head from 'next/head';
import Link from 'next/link';
import React from 'react'
export default class Page extends React.Component {
static async getInitialProps (ctx) {
return flash.get(ctx) || {}
@kuc-arc-f
kuc-arc-f / test_flash.js
Created Jan 14, 2021
Next.js, flash set sample
View test_flash.js
// Next.js, flash set sample
import flash from 'next-flash';
import Head from 'next/head';
import Link from 'next/link';
import React from 'react'
import Router from 'next/router'
export default class Page extends React.Component {
static async getInitialProps (ctx) {
return flash.get(ctx) || {}