Skip to content

Instantly share code, notes, and snippets.

@ruvaleev
ruvaleev / books.js
Created November 5, 2020 11:36
Books slice
import "regenerator-runtime/runtime";
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import axios from 'axios';
const initialState = { books: [], isLoading: false, isError: false, error: null }
const ROOT_URL = 'https://publisher-9bb8.restdb.io/rest';
const API_KEY = '5f9ff06b231ba42851b4a084'
export const fetchBooks = createAsyncThunk(
import React, { useState, useEffect } from 'react';
import { useForm } from 'react-hook-form';
import cx from 'classnames';
import Layout from 'components/shared/Layout';
import useFetchAuthors from 'components/hooks/useFetchAuthors';
const fetchAuthors = () => {
useFetchAuthors();
/* @media (--small-viewport) { */
@media (max-width: 500px) {
.row {
flex-wrap: wrap;
}
.half {
flex-basis: 50%;
max-width: 50%;
}
import React from 'react';
import SubscribeModal from './SubscribeModal';
import Authors from '../Authors/index';
// const childRef = React.createRef();
class Book extends React.Component {
constructor(props) {
super(props);
this.toggleSubscription = this.toggleSubscription.bind(this);
# Вот, например, мы коротко, и с виду, мило применяем put_authenticated
# dictionary_items_api_spec.rb
context 'when PUT v1/dictionary_items/:id' do
subject(:send_request) { put_authenticated("/dictionary_items/#{ id }", params) }
let(:params) { { dictionary_item: attributes_for(:dictionary_item) } }
it_behaves_like 'user authorization required', 'update', 'dictionary_items'
it_behaves_like 'updates and returns updated object', 'dictionary_item' do
let(:object) { dictionary_item }
@ruvaleev
ruvaleev / Deal status update
Created July 23, 2020 08:34
Попытка обновить статус заказа
Пытаюсь обновить статус заказа вот с такими параметрами:
params = {
"user":{
"email":"test@test.test"
},
"deal":{
"deal_number":"25848",
"deal_status":"false"
},
"system":{
$ cap production deploy
DEBUG [49761f31] Running [ -d $HOME/.rbenv/versions/2.6.5 ] as deploy@199.192.25.241
DEBUG [49761f31] Command: [ -d $HOME/.rbenv/versions/2.6.5 ]
DEBUG [49761f31] Finished in 3.711 seconds with exit status 0 (successful).
DEBUG [bc92df8c] Running /usr/bin/env which passenger as deploy@199.192.25.241
DEBUG [bc92df8c] Command: ( export RAILS_ENV="production" ; /usr/bin/env which passenger )
DEBUG [bc92df8c] /usr/bin/passenger
DEBUG [bc92df8c] Finished in 1.024 seconds with exit status 0 (successful).
INFO [6609a81e] Running /usr/bin/env mkdir -p /tmp as deploy@199.192.25.241
DEBUG [6609a81e] Command: ( export RAILS_ENV="production" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.5" ; /usr/bin/env mkdir -p /tmp )
[ba290ea0] Running RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle check --path /home/deploy/project/shared/bundle as deploy@199.192.25.241
DEBUG [ba290ea0] Command: cd /home/deploy/project/releases/20200626101855 && ( export RAILS_ENV="production" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.5" ; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle check --path /home/deploy/project/shared/bundle )
DEBUG [ba290ea0] Could not find net-http-pipeline-1.0.1 in any of the sources
Run `bundle install` to install missing gems.
DEBUG [ba290ea0] Finished in 1.332 seconds with exit status 7 (failed).
INFO [7f610777] Running RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle install --path /home/deploy/project/shared/bundle --jobs 1 --without development test --deployment --quiet as deploy@199.192.25.241
DEBUG [7f610777] Command: cd /home/deploy/project/releases/20200626101855 && ( export RAILS_ENV="production" RBENV_ROO
Install missing gems with `bundle install`
DEBUG [d8f3659d] Finished in 1.391 seconds with exit status 1 (failed).
INFO [a85ffda1] Running RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/project/shared/bundle --jobs 1 --without development test --deployment --quiet as deploy@199.192.25.241
DEBUG [a85ffda1] Command: cd /home/deploy/project/releases/20200626092744 && ( export RAILS_ENV="production" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.5" ; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/project/shared/bundle --jobs 1 --without development test --deployment --quiet )
INFO [a85ffda1] Finished in 201.697 seconds with exit status 0 (successful).
DEBUG [e6339314] Running if test ! -d /home/deploy/project/releases/20200626092744; then echo "Directory does not exist '/home/deploy/project/releases/20200626092744'" 1>&2; false; fi as deploy@199.192.25.241
DEBUG [e6339314] Command: if test
# frozen_string_literal: true
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Load the SCM plugin appropriate to your project:
#