Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

chore(functions): use es6 style aync function styles#753

Merged
mydearxym merged 3 commits intodevfromes6-style-functions
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionssrc/components/MarkdownEditor/exportContent.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
*/
import { convertToRaw } from 'draft-js'

function encodeContent(text) {
const encodeContent =text => {
return text
.split('&')
.join('&')
Expand DownExpand Up@@ -43,6 +43,8 @@ class MentionGenerator {
}
}

export default function exportContent(contentState, options = {}) {
const exportContent =(contentState, options = {}) => {
return new MentionGenerator(contentState, options).generate()
}

export default exportContent
2 changes: 1 addition & 1 deletionsrc/components/StatusBox/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ import {
/* eslint-disable-next-line */
const log = buildLog('c:StatusBox:index')

function getDefaultMsg(success, error) {
const getDefaultMsg =(success, error) => {
if (success) {
return '已保存'
}
Expand Down
9 changes: 0 additions & 9 deletionssrc/containers/JoinModal/service.js
View file
Open in desktop

This file was deleted.

2 changes: 1 addition & 1 deletionsrc/containers/Preview/styles/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ const WIDE_CASE = [
const WIDE_WIDTH = '70%'
const NARROW_WIDTH = '40%'

function doTransform(visible) {
const doTransform =visible => {
return visible ? 'translate(0px, 0px)' : 'translate(105%, 0px)'
}

Expand Down
9 changes: 0 additions & 9 deletionssrc/containers/thread/RoadmapThread/service.js
View file
Open in desktop

This file was deleted.

2 changes: 1 addition & 1 deletionsrc/containers/viewer/VideoViewer/logic.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@ const sr71$ = new SR71()
let sub$ = null
let store = null

function loadVideo({ id }) {
const loadVideo =({ id }) => {
const userHasLogin = store.isLogin
const variables = { id, userHasLogin }
markLoading(true)
Expand Down
4 changes: 2 additions & 2 deletionssrc/hooks/useResize.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ import { useState, useEffect } from 'react'
const useWindowSize = cb => {
const isClient = typeof window === 'object'

function getSize() {
const getSize = () => {
return {
width: isClient ? window.innerWidth : undefined,
height: isClient ? window.innerHeight : undefined,
Expand All@@ -23,7 +23,7 @@ const useWindowSize = cb => {
return false
}

function handleResize() {
const handleResize = () => {
setWindowSize(getSize())
if (cb) cb(getSize())
}
Expand Down
6 changes: 3 additions & 3 deletionssrc/pages/communities/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ import CommunitiesContent from '@/containers/content/CommunitiesContent'

import { P } from '@/schemas'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -59,7 +59,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
// const { communityPath, thread } = ssrParseURL(props.req)
let resp
try {
Expand All@@ -71,7 +71,7 @@ export async function getServerSideProps(props) {
}

const {
category,
//category,
sessionState,
pagedCategories,
pagedCommunities,
Expand Down
8 changes: 4 additions & 4 deletionssrc/pages/communities/new.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ import NewCommunityContent from '@/containers/content/NewCommunityContent'

import { P } from '@/schemas'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -59,7 +59,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand All@@ -70,7 +70,7 @@ export async function getServerSideProps(props) {
}

const {
category,
//category,
sessionState,
pagedCategories,
pagedCommunities,
Expand All@@ -95,7 +95,7 @@ export async function getServerSideProps(props) {
return { props: { errorCode: null, ...initProps } }
}

function NewCommunityPage(props) {
const NewCommunityPage =props => {
const store = useStore(props)

const seoConfig = {
Expand Down
6 changes: 3 additions & 3 deletionssrc/pages/community.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,7 @@ import { P } from '@/schemas'
/* eslint-disable-next-line */
const log = buildLog('page:community')

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -85,7 +85,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
const { communityPath, thread, threadPath } = ssrParseURL(props.req)

let resp
Expand DownExpand Up@@ -152,7 +152,7 @@ export async function getServerSideProps(props) {
return { props: { errorCode: null, ...initProps } }
}

function CommunityPage(props) {
const CommunityPage =props => {
const store = useStore(props)

const { errorCode, viewing } = store
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/cool-guide.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ import CoolGuideContent from '@/containers/content/CoolGuideContent'

import { useStore } from '@/stores/init'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand All@@ -33,7 +33,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/have-a-drink.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import HaveADrinkContent from '@/containers/content/HaveADrinkContent'

import { useStore } from '@/stores/init'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand All@@ -32,7 +32,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand Down
6 changes: 3 additions & 3 deletionssrc/pages/home/posts.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,7 @@ import { P } from '@/schemas'
/* eslint-disable-next-line */
const log = buildLog('page:community')

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -85,7 +85,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
const { communityPath, thread, threadPath } = ssrParseURL(props.req)

let resp
Expand DownExpand Up@@ -152,7 +152,7 @@ export async function getServerSideProps(props) {
return { props: { errorCode: null, ...initProps } }
}

function CommunityPage(props) {
const CommunityPage =props => {
const store = useStore(props)

const { errorCode, viewing } = store
Expand Down
6 changes: 3 additions & 3 deletionssrc/pages/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,7 @@ import { P } from '@/schemas'
/* eslint-disable-next-line */
const log = buildLog('page:community')

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -85,7 +85,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
const { communityPath, thread } = ssrParseURL(props.req)

let resp
Expand DownExpand Up@@ -146,7 +146,7 @@ export async function getServerSideProps(props) {
return { props: { errorCode: null, ...initProps } }
}

function CommunityPage(props) {
const CommunityPage =props => {
const store = useStore(props)

const { errorCode, viewing } = store
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/interview.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@ import InterviewContent from '@/containers/content/InterviewContent'

import { P } from '@/schemas'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand All@@ -35,7 +35,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/job.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ import JobContent from '@/containers/content/JobContent'

import { P } from '@/schemas'

async functionfetchData(props) {
constfetchData = asyncprops => {
const token = getJwtToken(props)
const gqClient = makeGQClient(token)
const userHasLogin = nilOrEmpty(token) === false
Expand DownExpand Up@@ -52,7 +52,7 @@ async function fetchData(props) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
const { mainPath } = ssrParseURL(props.req)

let resp
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/meetups.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ import MeetupsContent from '@/containers/content/MeetupsContent'

import { useStore } from '@/stores/init'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand All@@ -33,7 +33,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/post.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ import PostContent from '@/containers/content/PostContent'

import { P } from '@/schemas'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -55,7 +55,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
const { mainPath } = ssrParseURL(props.req)

let resp
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/recipes.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import GlobalLayout from '@/containers/GlobalLayout'
import RecipesContent from '@/containers/content/RecipesContent'
import { useStore } from '@/stores/init'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand All@@ -32,7 +32,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/repo.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ import RepoContent from '@/containers/content/RepoContent'

import { P } from '@/schemas'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand DownExpand Up@@ -52,7 +52,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
const { mainPath } = ssrParseURL(props.req)

let resp
Expand Down
4 changes: 2 additions & 2 deletionssrc/pages/sponsor.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import SponsorContent from '@/containers/content/SponsorContent'

import { useStore } from '@/stores/init'

async functionfetchData(props, opt) {
constfetchData = async(props, opt) => {
const { realname } = merge({ realname: true }, opt)

const token = realname ? getJwtToken(props) : null
Expand All@@ -32,7 +32,7 @@ async function fetchData(props, opt) {
}
}

exportasync functiongetServerSideProps(props) {
exportconstgetServerSideProps = asyncprops => {
let resp
try {
resp = await fetchData(props)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp