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 { useEffect } from "react"; | |
| import { useLocation } from "react-router-dom"; | |
| export const usePageTracking = () => { | |
| const location = useLocation(); | |
| useEffect(() => { | |
| window.gtag("event", "page_view", { | |
| page_path: location.pathname + location.search + location.hash, | |
| page_search: location.search, |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <!-- ... --> | |
| <script | |
| async | |
| src="https://www.googletagmanager.com/gtag/js?id=G-xxxxxxxxxx" > | |
| </script> | |
| <script> |
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
| FactoryBot.define do | |
| factory :xyz_service_get_entities_response, class: OpenStruct do | |
| skip_create | |
| initialize_with do | |
| new(attributes.except(:body).merge({ body: attributes[:body].to_json })) | |
| end | |
| transient do | |
| ... | |
| end |
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
| allow(XyzService).to receive(:get_entities).and_return( | |
| build(:xyz_service_get_entities_response, page: 2, ids: 10..19, total: 32) | |
| ) |
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
| FactoryBot.define do | |
| factory :xyz_service_get_entities_response, class: Hash do | |
| skip_create | |
| initialize_with { { body: attributes[:body].to_json }.stringify_keys } | |
| transient do | |
| ids { [1, 2, 3] } | |
| page { 1 } | |
| count { ids.count } | |
| end |
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
| allow(XyzService).to receive(:get_entities).and_return( | |
| build(:xyz_service_get_entities_response, body: { data: ... }) | |
| ) |
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
| OAUTH_COGNITO_ID=abcd123 | |
| OAUTH_COGNITO_SECRET=abcd123 | |
| OAUTH_COGNITO_REDIRECT_URL=http://localhost:3000/auth/cognito/redirect | |
| OAUTH_COGNITO_DOMAIN=https://test-app.auth.us-east-1.amazoncognito.com |
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 { Controller, Get, Req, Res, UseGuards } from '@nestjs/common'; | |
| import { Response, Request } from 'express'; | |
| import { CognitoOauthGuard } from './cognito-oauth.guard'; | |
| @Controller('auth/cognito') | |
| export class CognitoOauthController { | |
| constructor(private jwtAuthService: JwtAuthService) {} | |
| @Get() | |
| @UseGuards(CognitoOauthGuard) |
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 { Controller, Get, Req, Res, UseGuards } from '@nestjs/common'; | |
| import { Request, Response } from 'express'; | |
| import { GoogleOauthGuard } from './google-oauth.guard'; | |
| import { JwtAuthService } from '../jwt/jwt-auth.service'; | |
| @Controller('auth/google') | |
| export class GoogleOauthController { | |
| constructor(private jwtAuthService: JwtAuthService) {} | |
| @Get() |
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 { Injectable } from '@nestjs/common'; | |
| import { AuthGuard } from '@nestjs/passport'; | |
| @Injectable() | |
| export class JwtAuthGuard extends AuthGuard('jwt') {} |
NewerOlder