def fetch.after

cswap-bend-cli@0.1.0.0 · usage.bend:115

import cswap-bend-cli@0.1.0.0/usage.bend as Usage
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/usage/req.bend as UReq
import cswap-bend-cli@0.1.0.0/usage/cred.bend as UCred
import cswap-bend-cli@0.1.0.0/usage/gate.bend as UGate

115# 401 on an inactive account with a refresh token: refresh once, retry once.
116def fetch.after(r: Result<&2, &2, UReq.Err, Json.Json>, gate: UGate.Gate, +cred: String, +o: Json.Json, +active: Bool, +now: U32, +off: U32, upd: Maybe<&2, String>) -> IO(Fetched):
117  match r:
118    case Done{d}:
119      done(out.ok(d, now, off), upd)
120    case Fail{+e}:
121      fail.refresh(is_401(e) && Bool.not(active) && UCred.has_refresh(o), e, gate, cred, now, off, upd)

Uses (17)

Used by (1)