-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove ReCAPTCHA and add login function
- Loading branch information
kris liu
authored and
kris liu
committed
Jul 20, 2022
1 parent
29f6334
commit f42d458
Showing
7 changed files
with
86 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
interface CustomFieldItems { | ||
[key: string]: any | ||
} | ||
|
||
export const convertObjectToGraphql = (data: CustomFieldItems) => { | ||
if (typeof data === 'string' || typeof data === 'number') { | ||
return data | ||
} | ||
let str = '{' | ||
Object.keys(data).forEach((item: any, index) => { | ||
if (typeof data[item] === 'string' || typeof data[item] === 'number') { | ||
if (index === Object.keys(data).length - 1) { | ||
str += `${item}: ` | ||
str += `${JSON.stringify(`${data[item]}`)}` | ||
} else { | ||
str += `${item}: ` | ||
str += `${JSON.stringify(`${data[item]}`)}, ` | ||
} | ||
} | ||
|
||
if (Object.prototype.toString.call(data[item]) === '[object Object]') { | ||
str += `${item}: ` | ||
str += convertObjectToGraphql(data[item]) | ||
} | ||
|
||
if (Object.prototype.toString.call(data[item]) === '[object Array]') { | ||
str += `${item}: [` | ||
data[item].forEach((list: any) => { | ||
str += convertObjectToGraphql(list) | ||
}) | ||
str += '],' | ||
} | ||
}) | ||
str += '},' | ||
|
||
return str | ||
} | ||
|
||
export const convertArrayToGraphql = (data: CustomFieldItems) => { | ||
let str = '[' | ||
data.forEach((list: any) => { | ||
str += convertObjectToGraphql(list) | ||
}) | ||
str += ']' | ||
|
||
return str | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { | ||
convertArrayToGraphql, | ||
convertObjectToGraphql, | ||
} from './graphqlDataConvert' | ||
|
||
export { | ||
convertArrayToGraphql, | ||
convertObjectToGraphql, | ||
} |