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 'package:redux_example/src/redux/posts/posts_actions.dart'; | |
| import 'package:redux_example/src/redux/posts/posts_state.dart'; | |
| postsReducer(PostsState prevState, SetPostsStateAction action) { | |
| final payload = action.postsState; | |
| return prevState.copyWith( | |
| isError: payload.isError, | |
| isLoading: payload.isLoading, | |
| posts: payload.posts, | |
| ); |
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 'dart:convert'; | |
| import 'package:redux/redux.dart'; | |
| import 'package:meta/meta.dart'; | |
| import 'package:redux_example/src/models/i_post.dart'; | |
| import 'package:redux_example/src/redux/posts/posts_state.dart'; | |
| import 'package:redux_example/src/redux/store.dart'; | |
| import 'package:http/http.dart' as http; | |
| @immutable |
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 'package:meta/meta.dart'; | |
| import 'package:redux/redux.dart'; | |
| import 'package:redux_example/src/redux/posts/posts_actions.dart'; | |
| import 'package:redux_example/src/redux/posts/posts_reducer.dart'; | |
| import 'package:redux_example/src/redux/posts/posts_state.dart'; | |
| import 'package:redux_thunk/redux_thunk.dart'; | |
| AppState appReducer(AppState state, dynamic action) { | |
| if (action is SetPostsStateAction) { | |
| final nextPostsState = postsReducer(state.postsState, action); |
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 'package:flutter/material.dart'; | |
| import 'package:flutter_redux/flutter_redux.dart'; | |
| import 'package:redux_example/src/models/i_post.dart'; | |
| import 'package:redux_example/src/redux/posts/posts_actions.dart'; | |
| import 'package:redux_example/src/redux/store.dart'; | |
| void main() async { | |
| await Redux.init(); | |
| runApp(MyApp()); |
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
| class IPost { | |
| int id; | |
| int userId; | |
| String title; | |
| String body; | |
| IPost.fromJson(Map<String, dynamic> json) { | |
| if (json == null) return; | |
| id = json['id']; | |
| userId = json['userId']; |
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 'package:meta/meta.dart'; | |
| import 'package:redux_example/src/models/i_post.dart'; | |
| @immutable | |
| class PostsState { | |
| final bool isError; | |
| final bool isLoading; | |
| final List<IPost> posts; | |
| PostsState({ |
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 { useState, useEffect } from "react"; | |
| import { AxiosPromise } from "axios"; | |
| interface IState<T = any> { | |
| isLoading: boolean; | |
| isError: boolean; | |
| data: T; | |
| } | |
| const initialState: IState = { |
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 ProxyChain = require('proxy-chain'); | |
| const server = new ProxyChain.Server({ | |
| port: 8000, | |
| verbose: false, | |
| prepareRequestFunction: ({ request, username, password, hostname, port, isHttp }) => { | |
| return { | |
| requestAuthentication: username !== 'myusername' || password !== 'mypassword' | |
| }; | |
| }, | |
| }); |
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
| {"lastUpload":"2017-12-17T09:12:16.943Z","extensionVersion":"v2.8.7"} |