withApiMetadataFetchFn
url နှင့် method ကို fetchFn ၏ ဘေးတွင် တစ်ပြိုင်တည်း ကြေညာပါ။ ထိုသို့လုပ်ခြင်းဖြင့် ခွင့်ပြုချက် စစ်ဆေးမှုသည် အမှန်တကယ် endpoint နှင့် မကွဲပြားပါ။
TSXapi
1import { withApiMetadataFetchFn } from "@quan-erp/shared-types";
2
3export const getBranchApi = withApiMetadataFetchFn({
4 api: { method: "GET", url: "/branch" },
5 fetchFn: async () => { /* return payload */ },
6});Protected pages
စာမျက်နှာများကို <Protected requiredApis={getBranchApi} ...> ဖြင့် ခြုံထားပါ။ ခွင့်မရှိသော အသုံးပြုသူသည် ပျက်နေသော မျက်နှာပြင် မဟုတ်ဘဲ၊ ကန့်သတ်ထားသော fallback ကိုသာ မြင်ရပါသည်။