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 { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' | |
| import { Pokemon } from './types' | |
| // Define a service using a base URL and expected endpoints | |
| export const pokemonApi = createApi({ | |
| reducerPath: 'pokemonApi', | |
| baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }), | |
| endpoints: (builder) => ({ | |
| getPokemonByName: builder.query<Pokemon, string>({ | |
| query: (name) => `pokemon/${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 { Button, createTheme, ThemeProvider } from '@mui/material'; | |
| import React from 'react'; | |
| import './App.scss'; | |
| import styles from './style.module.scss'; | |
| function App() { | |
| const theme = createTheme({ | |
| palette: { | |
| primary: { | |
| main: styles.colorPrimary |
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
| <template> | |
| <button @click="signIn">login</button> | |
| <button @click="signOut">log out</button> | |
| <div>{{ user }}</div> | |
| </template> | |
| <script lang="ts"> | |
| import { defineComponent, onMounted, ref } from '@vue/runtime-core'; | |
| import { initFacebook, login, logout } from './FacebookAuth'; | |
| export default defineComponent({ |
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
| export interface FaceBookResponse { | |
| email: string; | |
| name: string; | |
| picture: string; | |
| authResponse: any; | |
| } | |
| // import * as Facebook from 'fb-sdk-wrapper'; | |
| // eslint-disable-next-line @typescript-eslint/no-var-requires | |
| import * as Facebook from 'fb-sdk-wrapper'; |
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
| <template> | |
| <button @click="signIn">login</button> | |
| <button @click="signOut">log out</button> | |
| <div>{{ user }}</div> | |
| </template> | |
| <script lang="ts"> | |
| import { defineComponent, onMounted, ref } from '@vue/runtime-core'; | |
| import { installGoogleAuth } from './GoogleAuth'; | |
| export default defineComponent({ |
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
| export async function installGoogleAuth(options: any): Promise<any> { | |
| // set config | |
| let GoogleAuthConfig: any = null; | |
| const GoogleAuthDefaultConfig = { | |
| scope: 'profile email' | |
| }; | |
| let prompt = 'select_account'; | |
| if (typeof options === 'object') { | |
| GoogleAuthConfig = Object.assign(GoogleAuthDefaultConfig, options); | |
| if (options.scope) { |
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 googleAuth = ((): any => { | |
| const installClient = () => { | |
| const apiUrl = 'https://apis.google.com/js/api.js'; | |
| return new Promise<void>((resolve) => { | |
| const script: any = document.createElement('script'); | |
| script.src = apiUrl; | |
| script.onreadystatechange = script.onload = () => { | |
| if (!script.readyState || /loaded|complete/.test(script.readyState)) { | |
| setTimeout(() => { |