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.

Commit7196d5c

Browse files
committed
chore(functions): use es6 style aync function styles (#753)
* chore(functions): use es6 style aync function styles* fix: missing one* chore: resolve conflict
1 parent277149a commit7196d5c

File tree

26 files changed

+55
-53
lines changed

26 files changed

+55
-53
lines changed

‎src/components/MarkdownEditor/exportContent.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import{convertToRaw}from'draft-js'
55

6-
functionencodeContent(text){
6+
constencodeContent=text=>{
77
returntext
88
.split('&')
99
.join('&')
@@ -43,6 +43,8 @@ class MentionGenerator {
4343
}
4444
}
4545

46-
exportdefaultfunctionexportContent(contentState,options={}){
46+
constexportContent=(contentState,options={})=>{
4747
returnnewMentionGenerator(contentState,options).generate()
4848
}
49+
50+
exportdefaultexportContent

‎src/components/StatusBox/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
/* eslint-disable-next-line */
2626
constlog=buildLog('c:StatusBox:index')
2727

28-
functiongetDefaultMsg(success,error){
28+
constgetDefaultMsg=(success,error)=>{
2929
if(success){
3030
return'已保存'
3131
}

‎src/containers/Preview/styles/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const WIDE_CASE = [
2525
constWIDE_WIDTH='70%'
2626
constNARROW_WIDTH='40%'
2727

28-
functiondoTransform(visible){
28+
constdoTransform=visible=>{
2929
returnvisible ?'translate(0px, 0px)' :'translate(105%, 0px)'
3030
}
3131

‎src/containers/viewer/VideoViewer/logic.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const sr71$ = new SR71()
1414
letsub$=null
1515
letstore=null
1616

17-
functionloadVideo({ id}){
17+
constloadVideo=({ id})=>{
1818
constuserHasLogin=store.isLogin
1919
constvariables={ id, userHasLogin}
2020
markLoading(true)

‎src/hooks/useResize.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useState, useEffect } from 'react'
99
constuseWindowSize=cb=>{
1010
constisClient=typeofwindow==='object'
1111

12-
functiongetSize(){
12+
constgetSize=()=>{
1313
return{
1414
width:isClient ?window.innerWidth :undefined,
1515
height:isClient ?window.innerHeight :undefined,
@@ -23,7 +23,7 @@ const useWindowSize = cb => {
2323
returnfalse
2424
}
2525

26-
functionhandleResize(){
26+
consthandleResize=()=>{
2727
setWindowSize(getSize())
2828
if(cb)cb(getSize())
2929
}

‎src/pages/communities/index.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import CommunitiesContent from '@/containers/content/CommunitiesContent'
2525

2626
import{P}from'@/schemas'
2727

28-
asyncfunctionfetchData(props,opt){
28+
constfetchData=async(props,opt)=>{
2929
const{ realname}=merge({realname:true},opt)
3030

3131
consttoken=realname ?getJwtToken(props) :null
@@ -59,7 +59,7 @@ async function fetchData(props, opt) {
5959
}
6060
}
6161

62-
exportasyncfunctiongetServerSideProps(props){
62+
exportconstgetServerSideProps=asyncprops=>{
6363
// const { communityPath, thread } = ssrParseURL(props.req)
6464
letresp
6565
try{
@@ -71,7 +71,7 @@ export async function getServerSideProps(props) {
7171
}
7272

7373
const{
74-
category,
74+
//category,
7575
sessionState,
7676
pagedCategories,
7777
pagedCommunities,

‎src/pages/communities/new.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import NewCommunityContent from '@/containers/content/NewCommunityContent'
2525

2626
import{P}from'@/schemas'
2727

28-
asyncfunctionfetchData(props,opt){
28+
constfetchData=async(props,opt)=>{
2929
const{ realname}=merge({realname:true},opt)
3030

3131
consttoken=realname ?getJwtToken(props) :null
@@ -59,7 +59,7 @@ async function fetchData(props, opt) {
5959
}
6060
}
6161

62-
exportasyncfunctiongetServerSideProps(props){
62+
exportconstgetServerSideProps=asyncprops=>{
6363
letresp
6464
try{
6565
resp=awaitfetchData(props)
@@ -70,7 +70,7 @@ export async function getServerSideProps(props) {
7070
}
7171

7272
const{
73-
category,
73+
//category,
7474
sessionState,
7575
pagedCategories,
7676
pagedCommunities,
@@ -95,7 +95,7 @@ export async function getServerSideProps(props) {
9595
return{props:{errorCode:null, ...initProps}}
9696
}
9797

98-
functionNewCommunityPage(props){
98+
constNewCommunityPage=props=>{
9999
conststore=useStore(props)
100100

101101
constseoConfig={

‎src/pages/community.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { P } from '@/schemas'
3232
/* eslint-disable-next-line */
3333
constlog=buildLog('page:community')
3434

35-
asyncfunctionfetchData(props,opt){
35+
constfetchData=async(props,opt)=>{
3636
const{ realname}=merge({realname:true},opt)
3737

3838
consttoken=realname ?getJwtToken(props) :null
@@ -85,7 +85,7 @@ async function fetchData(props, opt) {
8585
}
8686
}
8787

88-
exportasyncfunctiongetServerSideProps(props){
88+
exportconstgetServerSideProps=asyncprops=>{
8989
const{ communityPath, thread, threadPath}=ssrParseURL(props.req)
9090

9191
letresp
@@ -152,7 +152,7 @@ export async function getServerSideProps(props) {
152152
return{props:{errorCode:null, ...initProps}}
153153
}
154154

155-
functionCommunityPage(props){
155+
constCommunityPage=props=>{
156156
conststore=useStore(props)
157157

158158
const{ errorCode, viewing}=store

‎src/pages/cool-guide.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import CoolGuideContent from '@/containers/content/CoolGuideContent'
1313

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

16-
asyncfunctionfetchData(props,opt){
16+
constfetchData=async(props,opt)=>{
1717
const{ realname}=merge({realname:true},opt)
1818

1919
consttoken=realname ?getJwtToken(props) :null
@@ -33,7 +33,7 @@ async function fetchData(props, opt) {
3333
}
3434
}
3535

36-
exportasyncfunctiongetServerSideProps(props){
36+
exportconstgetServerSideProps=asyncprops=>{
3737
letresp
3838
try{
3939
resp=awaitfetchData(props)

‎src/pages/have-a-drink.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import HaveADrinkContent from '@/containers/content/HaveADrinkContent'
1212

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

15-
asyncfunctionfetchData(props,opt){
15+
constfetchData=async(props,opt)=>{
1616
const{ realname}=merge({realname:true},opt)
1717

1818
consttoken=realname ?getJwtToken(props) :null
@@ -32,7 +32,7 @@ async function fetchData(props, opt) {
3232
}
3333
}
3434

35-
exportasyncfunctiongetServerSideProps(props){
35+
exportconstgetServerSideProps=asyncprops=>{
3636
letresp
3737
try{
3838
resp=awaitfetchData(props)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp