142 lines
4.2 KiB
TypeScript
142 lines
4.2 KiB
TypeScript
// Module ID: 12327
|
|
// Function ID: 12328
|
|
// Name: _fetchNote
|
|
// Dependencies: [5, 19, 12328, 676, 589, 709, 530, 2]
|
|
// Exports: default
|
|
|
|
// Module 12327 (_fetchNote)
|
|
import dispatcher from "dispatcher";
|
|
import noop from "noop";
|
|
import getNote from "getNote";
|
|
import { Endpoints } from "ME";
|
|
|
|
const require = arg1;
|
|
function _fetchNote() {
|
|
const self = this;
|
|
const tmp = callback((arg0) => {
|
|
let closure_0 = arg0;
|
|
let c5 = 0;
|
|
let c6 = 0;
|
|
let c4 = 0;
|
|
return (function*(arg0, body) {
|
|
if (c6 === 2) {
|
|
c6 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw body;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = body;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c6 = 2;
|
|
if (0 === c5) {
|
|
if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw body;
|
|
} else if (arg0 === 2) {
|
|
c6 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = body;
|
|
return obj;
|
|
} else {
|
|
const dependencyMap = tmp3;
|
|
body = tmp7;
|
|
body = undefined;
|
|
const obj1 = { type: "USER_NOTE_LOAD_START", userId: null };
|
|
obj1[1] = callback;
|
|
outer1_1(outer1_2[5]).dispatch(obj1);
|
|
let c4 = 1;
|
|
const HTTP = callback(outer1_2[6]).HTTP;
|
|
const obj2 = { url: null, oldFormErrors: true, rejectWithError: true };
|
|
obj2[0] = c6.NOTE(callback);
|
|
c5 = 2;
|
|
c6 = 1;
|
|
let obj3 = { value: null, done: false };
|
|
obj3[0] = HTTP.get(obj2);
|
|
return obj3;
|
|
}
|
|
} else {
|
|
if (1 === tmp7) {
|
|
c4 = 0;
|
|
obj3 = body(709);
|
|
const obj4 = { type: "USER_NOTE_UPDATE", id: null };
|
|
obj4[1] = callback;
|
|
obj3.dispatch(obj4);
|
|
c6 = 3;
|
|
} else if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw body;
|
|
} else if (arg0 === 2) {
|
|
c4 = 0;
|
|
c6 = 3;
|
|
const obj5 = { value: null, done: true };
|
|
obj5[0] = body;
|
|
return obj5;
|
|
} else {
|
|
body = body.body;
|
|
if (body.note_user_id === callback) {
|
|
obj = body(709);
|
|
const obj6 = { type: "USER_NOTE_UPDATE", id: null, note: null };
|
|
obj6[1] = callback;
|
|
obj6[2] = body.note;
|
|
obj.dispatch(obj6);
|
|
c4 = 0;
|
|
}
|
|
}
|
|
const _Error = Error;
|
|
const error = new Error("Invalid response from server");
|
|
throw error;
|
|
}
|
|
} catch (tmp26) {
|
|
let dispatcher = tmp26;
|
|
if (tmp4 === c4) {
|
|
c6 = tmp2;
|
|
throw tmp26;
|
|
} else {
|
|
c5 = tmp;
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _fetchNote = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
const result = require("getNote").fileFinishedImporting("modules/user_profile/hooks/useNote.tsx");
|
|
|
|
export default function useNote(arg0) {
|
|
const _require = arg0;
|
|
const items = [getNote];
|
|
let stateFromStores = _require(589).useStateFromStores(items, () => outer1_5.getNote(closure_0));
|
|
const items1 = [stateFromStores, arg0];
|
|
const effect = React.useEffect(() => {
|
|
if (null == stateFromStores) {
|
|
(function fetchNote(closure_0) {
|
|
const self = this;
|
|
const apply = closure_7.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(closure_0);
|
|
}
|
|
}, items1);
|
|
if (stateFromStores == null) {
|
|
stateFromStores = { loading: true, note: null };
|
|
}
|
|
return stateFromStores;
|
|
};
|